Write a program in c to calculate sum of ten numbers using array
/* Write a program in c to calculate sum of ten numbers using array*/
#include<stdio.h>
void main()
{
int arr[100],i,sum=0;
printf("\n C Program to add 10 numbers using arrays : \n\n");
for(i = 1; i<=10;i++)
{
scanf("%d",&arr[i]);
}
for(i = 1; i<=10;i++)
{
sum = sum + arr[i];
}
printf("\n sum of all 10 numbers is : %d",sum);
}
Comments
Post a Comment