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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2205


What is this pointer in c plus plus?

600


What are the Advantages of using macro

689


Can you explain the four storage classes in C?

646


the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....

22248






Can we declare function inside main?

572


Can you subtract pointers from each other? Why would you?

563


What is a stream water?

663


What is the purpose of ftell?

601


List some of the dynamic data structures in C?

794


Write a program to reverse a given number in c language?

624


What is a program flowchart?

609


A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

1516


Do you know null pointer?

616


Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80

2561