write a program to find the sum of the array elements in c
language?
Answer Posted / bishmeet singh
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,n,sum=0;
printf("enter the no. of elements");
back:
scanf("%d",&n);
if(n<10)
{
printf("elements sholud be less than 10\n enter again");
goto back;
}
printf("Enter %d elements",n);
for(i=0;i<n;i++)
{
scanf("%d",a[i]);
sum=sum+a[i];
}
printf("sum of your entered elements is %d",sum);
getch();
}
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is use of pointer?
What is wrong with this statement? Myname = 'robin';
I came across some code that puts a (void) cast before each call to printf. Why?
What are the types of assignment statements?
What are the advantages of using macro in c language?
What is typedf?
Why void is used in c?
What is a void pointer in c?
How can I split up a string into whitespace-separated fields?
What is difference between %d and %i in c?
Why does the call char scanf work?
How will you delete a node in DLL?
Why is c used in embedded systems?
Can you please explain the scope of static variables?
What is unsigned int in c?