-->

Header Ads

WAP to sum all element given in array

C Program:


#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],b,sum=0;
clrscr();
for(b=0;b<5;b++)
{
printf("Enter no to summation:");
scanf("%d",&a[b]);
sum=sum+a[b];
}
printf("\nsum is:%d",sum);
getch();
}


Output of c program:

No comments

Powered by Blogger.