ACCEPT 30 VALUES IN AN INT ARRAY & PRINT SUM OF ALL VALUES ENTERED


#include<stdio.h>
#include<conio.h>
void main()
{
int a[30],i,s=0;
printf("Enter 30 Values");
for(i=0;i<=29;i++)
  {
  scanf("%d",&a[i]);
  }
  for(i=0;i<30;i++)
    {
    s=s+a[i];
    }
    printf("Sum of all Elements=%d",s);
getch();
}

0 comments: (+add yours?)

Post a Comment