Addition of number using an array
// add n number using an array
#include<stdio.h>
int main()
{
int array[100],a,b,n,sum;
printf("enter the value through which you want to add:");
scanf("%d",&n);
printf("enter %d integers:",n);
for(a=0;a<=n;a++)
{
scanf("%d",&array[a]);
sum= sum+ array[a];
}
printf("%d",sum);
}
Comments
Post a Comment