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
Why does this code crash?
How is actual parameter different from the formal parameter?
How many header files are in c?
Can 'this' pointer by used in the constructor?
When should the const modifier be used?
Tell me what are bitwise shift operators?
How to draw the flowchart for structure programs?
Is c dynamically typed?
What does int main () mean?
What is main return c?
What is size of union in c?
What are enumerated types?
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(); }
Why & is used in c?
Can I initialize unions?