write a program to find the sum of the array elements in c
language?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vaibhav
#include<stdio.h>
#include<conio.h>
void main()
{
int n[5],sum=0,i=0;
clrscr();
for(i=0;i<4;i++)
{
scanf("%d",&n[i]);
}
for(i=0;i<4;i++)
{
sum=sum+n[i];
}
printf("sum are%d",sum);
getch();
}
Is This Answer Correct ? | 72 Yes | 41 No |
Answer / karnik ankit
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,sum=0;
clrscr();
for(i=0;i<10;i++)
{
printf("\n enter an elements in array");
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
sum=sum+a[i];
}
printf("\n sum is %d",sum);
}
Is This Answer Correct ? | 40 Yes | 20 No |
Answer / rajkumar
//c program of sum array element
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,sum=0,n,a[100];
clrscr();
printf("How many number are you entering(less than 100) ?");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
//sum of array element
for(i=1;i<=n;i++)
{
sum=sum+a[i];
}
printf("Sum of your entered number is=%d",sum);
getch();
}//End of main
Is This Answer Correct ? | 24 Yes | 9 No |
Answer / vijay
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,sum=0;
clrscr();
for(i=0;i<10;i++)
{
printf("\n enter an elements in array");
scanf("%d",&a[i]);
}
for(i=0;i<10;i++)
{
sum=sum+a[i];
}
printf("\n sum is %d",sum);
}
Is This Answer Correct ? | 27 Yes | 17 No |
Answer / syed shoaib
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int i,b=0;
printf("Enter the array elements\n");
for (i=0; i<5; i++)
scanf("%d",&a[i]);
for (i=0; i<5; i++)
{
b=b+a[i];
}
printf("Sum of array elements is %d",b);
}
Is This Answer Correct ? | 19 Yes | 13 No |
Answer / sumit aseri
/* programm of sum of array value*/
#include<stdio.h>
#include<conio.h>
void main()
{
int array[10],i,sum=0;
for(i=0;i<10;i++)
{
scanf("%d",&array[i];
printf("entered digits are=%d",array[i];
}
sum=sum+array[i]'
for(i=0;i<10;i++)
{
printf("the sum of digits=%d",sum);
}
getch();
}
/*join me on orkut search by name. i will solve your
problem*/
Is This Answer Correct ? | 19 Yes | 13 No |
Answer / aisha
#include<Stdio.h>
void main()
{
int sum=0,a[10],i,n;
printf("enter value of n");
scanf("%d",&n);
printf("enter array elements");
for(i=o;i<=n;;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
sum= sum+a[i];
}
printf("sum of all array elements = %d",sum);
}
Is This Answer Correct ? | 11 Yes | 5 No |
Answer / m.sushma
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],sum=0,n,i;
printf("Enter range");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("The sum of all the elements in the given array
is\n");
for(i=0;i<n;i++)
sum=sum+a[i];
printf("%d",sum);
getch();
}
Is This Answer Correct ? | 19 Yes | 15 No |
why effort estimation is important?
write a programme to enter some number and find which number is maximum and which number is minimum from enterd numbers.
Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s)
what are # pragma staments?
What is struct node in c?
What is the most efficient way to count the number of bits which are set in a value?
What is a class c rental property?
How do I use strcmp?
char ch=10;printf("%d",ch);what is the output
wht is the difference between KPO and BPO ?
2 Answers Accenture, BPO, HCK, HCL, Infosys,
write aprogram for There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.
1 Answers iGate, Shashi, Source Bits, Subex,
Write code for finding depth of tree