write a program to find the sum of the array elements in c
language?
Answer Posted / asish manoj k
#include <conio.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n,r=0,i,a[10],s=0;
printf("enter the size of the array");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the %d element",r);
scanf("%d",&a[i]);
r=r+1;
}
for(i=0;i<n;i++)
{
s=s+a[i];
}
printf("sum of the elements of the array is %d",s);
system("PAUSE");
return EXIT_SUCCESS;
}
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are the types of assignment statements?
What is #pragma statements?
How many keywords (reserve words) are in c?
What is FIFO?
Explain the difference between call by value and call by reference in c language?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
What does %2f mean in c?
What is calloc() function?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What is the explanation for modular programming?
How is a structure member accessed?
What is a pragma?
What is the use of bit field?
How can you read a directory in a C program?
How pointers are declared?