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
What is the use of parallelize in spark?
What are the storage classes in C?
Write a simple code fragment that will check if a number is positive or negative.
why we wont use '&' sing in aceesing the string using scanf
Is fortran faster than c?
What is c language & why it is used?
find out largest elemant of diagonalmatrix
What is realloc in c?
What is difference between %d and %i in c?
simple program of graphics and their output display
What are the uses of a pointer?
What is #define in c?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is sizeof return in c?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?