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 |
The C language terminator is a.semicolon b.colon c.period d.exclamation mark
How can I allocate arrays or structures bigger than 64K?
how to convert binary to decimal and decimal to binary in C lanaguage
7 Answers BPO, Far East Promotions, IBM, RBS,
What are the rules for the identifier?
what will be printed by this printf? printf("%c",printf("hi")["sharkselva"])); }
Write a program to maintain student’s record. Record should not be available to any unauthorized user. There are three (3) categories of users. Each user has its own type. It depends upon user’s type that which kind of operations user can perform. Their types and options are mentioned below: 1. Admin (Search Record [by Reg. No or Name], View All Records, Insert New Record, Modify Existing Record) 2. Super Admin (Search Record [by Reg. No or Name], View All Records, Insert New Record, Modify Existing Record, Delete Single Record) 3. Guest (Search Record [by Reg. No or Name], View All Records) When first time program runs, it asks to create accounts. Each user type has only 1 account (which means that there can be maximum 3 accounts). In account creation, following options are required: Login Name: <6-10 alphabets long, should be unique> Password: <6-10 alphabets long, should not display characters when user type> Confirm Password: <must match with the Password, should not display characters when user type> Account Type: <One character long, A or S or G where A for Admin, S for Super Admin, G for Guest> Login Name, Password and Account Type should be stored in a separate file in encrypted form. (Encryption means that actual information should be changed and Decryption means that Encrypted information is changed back to the actual information) If any of the above mentioned requirement(s) does not meet then point out mistake and ask user to specify information again. When Program is launched with already created accounts, it will ask for user name and password to authenticate. On successful authentication, give options according to the user’s type.
Explain what does it mean when a pointer is used in an if statement?
What is the difference between formatted&unformatted i/o functions?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
write a program to find the largest and second largest integer from an array
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}
write a program to gat the digt sum of a number (et. 15= >1+5=6)