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

Answer Posted / uday

#include<stdio.h>
void main()
{
int a[i],sum=0;
printf("enter n value");
scanf("%d",&n);
for(i=0;i<n,i++)
{
scanf("%d",&a[i])
}
for(i=0;i<n;i++)
{
sum=sum+a[i];
}
printf("sum=%d");
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of type declarations?

683


what do u mean by Direct access files? then can u explain about Direct Access Files?

1647


What is character set?

687


In a switch statement, what will happen if a break statement is omitted?

607


Explain what happens if you free a pointer twice?

616






Which built-in library function can be used to match a patter from the string?

750


What is the difference between a string and an array?

711


What is an identifier?

632


What is include directive in c?

650


Write a program to print all permutations of a given string.

647


What are the basic data types associated with c?

820


Is it better to bitshift a value than to multiply by 2?

664


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2124


Are comments included during the compilation stage and placed in the EXE file as well?

674


What is the use of typedef in structure in c?

549