google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to find the sum of all array elements - 2nd puc computer science

Write a c program to find the sum of all array elements

Write a c program to find the sum of all array elements

#include<stdio.h>

#include<conio.h>

void main()

{

int a[10],i,sum=0,n;

clrscr();

printf("How many elements?");

scanf("%d",&n);

printf("Enter the elements\n");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

for(i=0;i<n;i++)

sum=sum+a[i];

printf("sum=%d",sum);

getch();

}

Write a c program to find the sum of all array elements Write a c program to find the sum of all array elements Reviewed by Vision Academy on December 26, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.