write a program to find the sum of the array elements in c
language?
Answer Posted / heemashree
#include "stdio.h"
#include "conio.h"
#include "stdafx.h"
void main()
{
int a[10];
int i,sum=0,n;
printf("enter number of elements");
scanf("%d",&n);
printf("Enter the array elements\n");
for (i=0; i<n; i++)
scanf("%d",&a[i]);
// sum of array elements
for (i=0; i<n; i++)
{
sum=sum+a[i];
}
printf("Sum of array elements===%d",sum);
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
How can I recover the file name given an open stream?
What are the back slash character constants or escape sequence charactersavailable in c?
What is the use of getchar functions?
Why does the call char scanf work?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
What is formal argument?
Explain is it better to bitshift a value than to multiply by 2?
What is a good way to implement complex numbers in c?
Is there a way to jump out of a function or functions?
int i=10; printf("%d %d %d", i, i=20, i);
Write a C program in Fibonacci series.
What are operators in c?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler