write a program to find the sum of the array elements in c
language?
Answer Posted / 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 |
Post New Answer View All Answers
What is the use of a static variable in c?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
What are the different types of pointers used in c language?
What are control structures? What are the different types?
Should I learn c before c++?
What is the purpose of the statement: strcat (S2, S1)?
What are the header files used in c language?
What does *p++ do?
What is the use of gets and puts?
What is the best way of making my program efficient?
What is the condition that is applied with ?: Operator?
Here is a good puzzle: how do you write a program which produces its own source code as output?
Explain what is the difference between a string and an array?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
What are volatile variables in c?