Search C Program

Sum of Array

/* Sum of Array */
#include<stdio.h>

int main()
{
 int arr[10],i,sum=0;
 printf("Please enter 10 values:\n");
 for(i=0;i<10;i++)
  scanf("%d",&arr[i]);
 
 for(i=0;i<10;i++)
  sum=sum+arr[i];
 
 printf("Sum of Array: %d",sum);
 return 0;
}

No comments:

Post a Comment