write a program to find the sum of the array elements in c
language?

Answers were Sorted based on User's Feedback



write a program to find the sum of the array elements in c language?..

Answer / atul lakhera

#include<stdio.h>
#include<conio.h>
void main()
{
int num[10], sum=0;
for(int i=0; i<10; i++)
{
printf("Enter number=");
scanf("%d", &num[i]);
}
printf("Sum of elemets=");
for(i=0; i<10; i++)
{
sum=sum+num[i];
printf("%d", sum);
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No

write a program to find the sum of the array elements in c language?..

Answer / raushan kumar

# include <stdio.h>
# include <conio.h>
void main()
{
int arr[value],sum=0;
int i;
clrscr();
printf("Enter data in array");
/*store data in array*/
for(i=1;i<value;i++)
{
scanf("%d",&arr[i]);
}
/*Print data in array*/
for(j=1;j<value;j++)
{
printf("%d",arr[i]);
sum=sum+arr[i];
}
/*Sum of array element*/
printf("\nArray Element Sum=%d",sum);
getch();
}

Is This Answer Correct ?    3 Yes 2 No

write a program to find the sum of the array elements in c language?..

Answer / uday

#include<stdio.h>
void main()
{
int a[i],sum=0;
printf("enter n value");
scanf("%d",&n);
for(i=0;i<n,i++)
{
scanf("%d",&a[i])
}
for(i=0;i<n;i++)
{
sum=sum+a[i];
}
printf("sum=%d");
}

Is This Answer Correct ?    2 Yes 1 No

write a program to find the sum of the array elements in c language?..

Answer / asish manoj k

#include <conio.h>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int n,r=0,i,a[10],s=0;

printf("enter the size of the array");
scanf("%d",&n);

for(i=0;i<n;i++)
{
printf("enter the %d element",r);
scanf("%d",&a[i]);
r=r+1;

}
for(i=0;i<n;i++)
{

s=s+a[i];
}

printf("sum of the elements of the array is %d",s);
system("PAUSE");
return EXIT_SUCCESS;
}

Is This Answer Correct ?    2 Yes 1 No

write a program to find the sum of the array elements in c language?..

Answer / mohd hayyan

#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],i,sum=0;
clrscr();
printf("enter the array");
for(i=0;i<3;i++)
scanf("%d",&a[i]);
for(i=0;i<3;i++)
{
sum=sum+a[i];
}
for(i=0;i<3;i++)
{
printf("a[%d]=%d",i,a[i]);
}
printf("%d",sum);
getch();
}

Is This Answer Correct ?    1 Yes 0 No

write a program to find the sum of the array elements in c language?..

Answer / bishmeet singh

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],i,sum=0;
clrscr();
printf("enter the 5 elements to sum");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
printf("sum of the elements is %d",sum);
}

Is This Answer Correct ?    1 Yes 1 No

write a program to find the sum of the array elements in c language?..

Answer / sayeed khan

#include<stdio.h>
#include<conio.h>
int main()
{
int i,sum=0,a[30],n;

printf("Enter The Number=");

for(i=0;i<n;i++);

scanf("%d",&n);

sum=sum+a[i];

printf("the sum is %d\n",sum);

getch();
return 0;
}

Is This Answer Correct ?    1 Yes 1 No

write a program to find the sum of the array elements in c language?..

Answer / lalit suthar, nilod

// write a program to find the sum of the array elements in
c language?

#include<stdio.h>
#include<conio.h>

void main()
{
int a[5],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);

getch();
}

Is This Answer Correct ?    1 Yes 1 No

write a program to find the sum of the array elements in c language?..

Answer / 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

write a program to find the sum of the array elements in c language?..

Answer / ajay kumar pandit

Wap to calculste the sum number

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is call by value in c?

0 Answers  


What are the different categories of functions in c?

0 Answers  


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

0 Answers  


How to swap two values using a single variable ? condition: Not to use Array and Pointer ?

6 Answers  


What does it mean when a pointer is used in an if statement?

0 Answers  






What are operators in c?

0 Answers  


What is register variable in c language?

0 Answers  


Explain continue keyword in c

0 Answers  


Q-1: Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college.

8 Answers  


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1 Answers   IBM,


What is the use of pragma in embedded c?

0 Answers  


while initialization of two dimensional arrays we can initialize like a[][2] but why not a[2][] is there any reason behind this?

4 Answers   Aptech,


Categories