Tuesday, September 7, 2010

Find out sum of N Numbers

#include"stdio.h"
#include"conio.h"
void main()
{

 int i,n,a,sum=0;

 printf("Enter n no. values: ");
 scanf("%d",&n);
 printf("\nEnter values: ");

 for(i=1;i<=n;i++)
 {
  scanf("%d",&a);
  sum=sum+a;
 }
 printf("\n Sum of %d is= %d",n,sum);
 getch();

}

No comments: