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[5],i,sum=0;
clrscr();
printf("enter the 5 elements to sum");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
printf("sum of the elements is %d",sum);
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is bubble sort in c?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
Why is void main used?
What is meant by gets in c?
code for find determinent of amatrix
Is linux written in c?
Which driver is a pure java driver
What are the types of operators in c?
What does %c mean in c?
What does volatile do?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What is the use of parallelize in spark?
What is a MAC Address?
What is the return type of sizeof?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?