WAP that simply takes elements of the array from the user and finds the sum of these elements
#include<stdio.h> #include<conio.h> void main() { int a[5],i,sum; float avg=0.0; printf("Enter the elements of array"); for(i=0;i<5;i++) scanf("%d" ,&a[i]); sum=a[0]+a[1]+a[2]+a[3]+a[4]; printf("\n The sum of array is %d " ,sum); getch(); }
No comments:
Post a Comment