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

Answer Posted / bishmeet singh

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,n,sum=0;
printf("enter the no. of elements");
back:
scanf("%d",&n);
if(n<10)
{
printf("elements sholud be less than 10\n enter again");
goto back;
}
printf("Enter %d elements",n);
for(i=0;i<n;i++)
{
scanf("%d",a[i]);
sum=sum+a[i];
}

printf("sum of your entered elements is %d",sum);
getch();
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include...

4909


What is an expression?

661


What are nested functions in c?

569


all c language question

1878


How are structure passing and returning implemented?

594






Why array is used in c?

555


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

1881


What does #pragma once mean?

693


What is adt in c programming?

615


Tell me what is null pointer in c?

617


Are the variables argc and argv are local to main?

793


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1190


What is an endless loop?

806


Explain the red-black trees?

611


Is a pointer a kind of array?

602