Pages

Sunday, 7 July 2013

SUM OF ARRAY



#include<stdio.h>
void main()
 {
  int a[100],i,n,sum=0;
  printf("\n Enter the limit   :");
  scanf("%d",&n);
  printf("\nEnter the %d Numbers.....\n",n);
  for(i=0;i<n;i++)
   {
    scanf("%d",&a[i]);
    sum+=a[i];
   }
  printf("\nThe sum is %d  :",sum);
 }



No comments:

Post a Comment