This program is about adding the elements of the given array using for loop and print the value
#include<stdio.h> int main() { int i,j=0,n,a[10]; printf("\nEnter the Limit:"); scanf("%d",&n); printf("\nEnter the values:"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("\nGiven values are:"); for(i=0;i<n;i++) { printf("\na[%d]=%d",i,a[i]); } for(i=0;i<n;i++) { j=j+a[i]; } printf("\nTotal value is:%d",j); return 0; }To download raw file Click Here
Enter the Limit:5 Enter the values:1 2 3 4 5 Given values are: a[0]=1 a[1]=2 a[2]=3 a[3]=4 a[4]=5 Total values is:15
Learn All in Tamil © Designed & Developed By Tutor Joes