Get Update on recent Technology & Programming

Tuesday, 7 November 2017

C Program to add elements of an array

Posted by   on Pinterest


 #include<stdio.h>  
 int main(void)  
 {  
      int arr[10],i,sum=0;  
      for(i=0; i<10; i++)  
      {  
           printf("Enter a value for arr[%d] : ",i);  
           scanf("%d",&arr[i]);  
           sum+=arr[i];  
      }  
      printf("Sum=%d\n",sum);  
      return 0;  
 }  

No comments:
Write comments

Hey, we've just launched a new custom color Blogger template. You'll like it -
Join Our Newsletter