write a program to find the sum of the array elements in c
language?

Answer Posted / karnik ankit

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,sum=0;
clrscr();
for(i=0;i<10;i++)
{
printf("\n enter an elements in array");
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
sum=sum+a[i];
}
printf("\n sum is %d",sum);
}

Is This Answer Correct ?    40 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why does this code crash?

610


How is actual parameter different from the formal parameter?

583


How many header files are in c?

543


Can 'this' pointer by used in the constructor?

607


When should the const modifier be used?

650






Tell me what are bitwise shift operators?

648


How to draw the flowchart for structure programs?

8755


Is c dynamically typed?

660


What does int main () mean?

539


What is main return c?

507


What is size of union in c?

570


What are enumerated types?

644


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

1855


Why & is used in c?

701


Can I initialize unions?

579