#include<stdio.h> #include<conio.h> void main() { int i,a[50],sum,n; printf("n Enter no of elements :"); scanf("%d",&n); /* Reading values into Array */ printf("n Enter the values :"); for(i=0;i < n;i++) scanf("%d",&a[i]); /* computation of total */ sum=0; for(i=0;i < n;i++) sum=sum+a[i]; /* printing of all elements of array */ for(i=0;i < n;i++) printf("n a[%d]=%d",i,a[i]); /* printing of total */ printf("n sum=%d",sum); getch(); }
Next
« Prev Post
« Prev Post
Previous
Next Post »
Next Post »
Subscribe to:
Post Comments (Atom)