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

Answer Posted / anuja kulkarni

#include<stdio.h>
#include<conio.h>

void main()
{
int a[5];
int i,sum=0;

clrscr();
printf("Enter the array elements\n");
for (i=0; i<5; i++)
scanf("%d",&a[i]);

// sum of array elements
for (i=0; i<5; i++)
{
sum=sum+a[i];
}
printf("Sum of array elements===%d",sum);
} // end of main()

Is This Answer Correct ?    295 Yes 71 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between array and pointer in c?

536


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

630


Can you please compare array with pointer?

615


What is formal argument?

648


what is a constant pointer in C

677






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?

1591


Describe the header file and its usage in c programming?

616


write a c program for swapping two strings using pointer

2094


The statement, int(*x[]) () what does in indicate?

642


When should volatile modifier be used?

554


Why main function is special give two reasons?

944


What’s the special use of UNIONS?

657


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1524


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

1735


What is wrong with this statement? Myname = 'robin';

816