ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
write a program to find the sum of the array elements in c
language?
 Question Submitted By :: Srinivas
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 1
#include<stdio.h>
  #include<conio.h>
  
  void main()
  {
     int a[5];
     int 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);
    } // end of main()
 
Is This Answer Correct ?    11 Yes 8 No
Anuja Kulkarni
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 2
the above prog is perfect..
 
Is This Answer Correct ?    9 Yes 5 No
Shruti
 
 
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 3
#include<stdio.h>
#include<conio.h>
 void main()
{
  int n[5],sum=0,i=0;
  clrscr();
  for(i=0;i<4;i++)
  {
    scanf("%d",&n[i]);
  } 
   
for(i=0;i<4;i++)
  {
   sum=sum+n[i];
  }
printf("sum are%d",sum);
getch();
}
 
Is This Answer Correct ?    3 Yes 2 No
Vaibhav
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 4
#include<stdio.h>
#include<conio.h>
void main()
{
int i,a[10],sum;
clrscr();
printf("\n Enter the elements in an array :");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("\n The sum of elements of an array are :");
for((i=0;i<10;i++)
sum=sum+a[i];
printf("\t %d",sum);
getch();
}
 
Is This Answer Correct ?    0 Yes 3 No
Madhura Musale
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 5
#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 ?    3 Yes 1 No
Karnik Ankit
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 6
#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 ?    1 Yes 1 No
Vijay
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 7
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int i,b=0;
printf("Enter the array elements\n");
for (i=0; i<5; i++)
scanf("%d",&a[i]);
for (i=0; i<5; i++)
{
b=b+a[i];
}
printf("Sum of array elements is %d",b);
}
 
Is This Answer Correct ?    1 Yes 1 No
Syed Shoaib
 
  Re: write a program to find the sum of the array elements in c language?
Answer
# 8
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],sum=0,n,i;
printf("Enter range");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("The sum of all the elements in the given array 
is\n");
for(i=0;i<n;i++)
sum=sum+a[i];
printf("%d",sum);
getch();
}
 
Is This Answer Correct ?    0 Yes 1 No
M.sushma
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Write a program to find the given number is odd or even without using any loops(if,for,do,while)  2
Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?  2
how to exchnage bits in a byte b7<-->b0 b6<-->b1 b5<-->b2 b4<-->b3 please mail me the code if any one know to rajeshmb4u@gmail.com Honeywell3
program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.  3
how to copy a string without using c function  5
How to implement call back functions ? HP2
main() { float a=3.2e40; printf("%d",a); } Satyam5
who is the founder of c HP9
parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 output: 1 23 456 7891 23456 789123 sample2: enter the size: 5 enter the seed: 3 output: 3 45 678 9123 45678 parkside should not exceed 10 while its seed should only be not more than 9..  4
dynamically allocate memory for linear array of n integers,store some elements in it and find some of them  1
write a program to print sum of each row of a 2D array.  2
what is object oriental programing?  1
WAP to accept first name,middle name & last name of a student display its initials? NIIT2
What is the difference between null pointer and the void pointer?  2
Software Interview Questions CAT1
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 Wipro4
Why cann't whole array can be passed to function as value.  1
Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod() Accenture1
WRITE A PROGRAM TO FIND A REVERSE OF TWO NO  5
a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? a.infinite b.5 c.4 d.6 TCS5
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com