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

Calculate the sum up to N numbers using Array in C-Language



In this C-program we will calculate the sum upto 'N' numbers using array. The numbers will be taken from the user.color>

input:

'N' numbers.(i.e : 9,56,548)

output:

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

CODE---->


#include
#include
color>main()color>
{
int arr[50],i,n,sum=0;
printf("      How many numbers you want to enter ?\n color>");
scanf("%dcolor>",&n);
printf("      Please,Enter the 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 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 the sum up to N numbers using Array in C-Language

×

Subscribe to Programjoy.blogspot.com

Get updates delivered right to your inbox!

Thank you for your subscription

×