write a program to find the sum of the array elements in c
language?
Answer Posted / mathews m
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,sum=0,x[20];
clrscr();
printf("enter the array space");
scanf("%d",&n);
printf("enter the elements");
for(i=0;i<n;i++)
scanf("%d"&x[i]);
for(i=0;i<n;i++)
{
sum=sum+x[i];
}
printf("the sum of elements in an array=%d");
}
getch();
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How can I delete a file?
I need testPalindrome and removeSpace
#include
Difference between macros and inline functions? Can a function be forced as inline?
How to declare pointer variables?
Explain the difference between malloc() and calloc() function?
In c programming language, how many parameters can be passed to a function ?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Can you mix old-style and new-style function syntax?
What is realloc in c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Why does notstrcat(string, "!");Work?
How is a null pointer different from a dangling pointer?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
Explain what is the advantage of a random access file?
What is the purpose of sprintf() function?