Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Calculate sum of 5 numbers using Array in C-language



In this C-program we will scan the numbers using array and then we will calculate the sum of the given numbers, also using array. The numbers will be taken from the user.color>

input:

5 numbers.(i.e : 5,6,9,56,548)

output:

The sum of the given numbers will be printed on the screen.

CODE---->


#include
#include
color>main()color>
{
int arr[5],i,sum=0;
printf("      Enter Five numbers : color>");
for(i=0color>;icolor>;i++color>)
{
     scanf("%dcolor>",&arr[i]);
}
for(i=0color>;icolor>;i++color>)
{
     sum=sum+arr[i];
}
printf("\n      The sum of the given 5 numbers is : %d\ncolor>",sum);
system("pausecolor>");
}



Don't just read, write it, run it.....color>

RESULT:color>






This post first appeared on ProgramJoy.blogspot.com, please read the originial post: here

Share the post

Calculate sum of 5 numbers using Array in C-language

×

Subscribe to Programjoy.blogspot.com

Get updates delivered right to your inbox!

Thank you for your subscription

×