write a program to find the sum of the array elements in c
language?
Answer Posted / 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 |
Post New Answer View All Answers
Write a simple code fragment that will check if a number is positive or negative.
what is the difference between class and unio?
Write a program of advanced Fibonacci series.
Difference between Shallow copy and Deep copy?
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
What happens if you free a pointer twice?
What is the most efficient way to store flag values?
What is pointers in c?
Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.
Write a program to print ASCII code for a given digit.
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What is the use of #include in c?
What are the ways to a null pointer can use in c programming language?
How are pointers declared in c?
How is a macro different from a function?