ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2262)
 C++ interview questions  C++ Interview Questions (1118)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (647)
Question
write a 'c' program to sum the number of integer values
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
void main()
{
int a[25],n,i,sum=0;
printf("enter n value");
scanf("%d",&n);
printf("\n Enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
sum+=a[i];
printf("\nSum of the given numbers is %d",sum);
}
 
Is This Answer Correct ?    39 Yes 18 No
Durga Bhavani
 
Answer
# 2
#include<stdio.h>
#include<conio.h>
main()
{
int a[25],n,i,sum=0;
printf("enter n value");
scanf("%d",&n);
printf("\n Enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
sum+=a[i];
printf("\nSum of the given numbers is %d",sum);
}
 
Is This Answer Correct ?    11 Yes 5 No
Chandra
 
 
 
Answer
# 3
void main()
{
int sum,a=6,b=3;
clrscr();
sum=a+b;
printf("%d",sum);
}
getch();
}
 
Is This Answer Correct ?    3 Yes 0 No
Prince Rafi
 
Answer
# 4
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter a integer no:-"); scanf("%d",&a);
printf("Enter a Integer no:-"); scanf("%d",&b);
printf("Sum= %d",a+b);
getch();
}
 
Is This Answer Correct ?    13 Yes 12 No
Koushik Sarkar
 
Answer
# 5
#include<stdio.h>
#include<conio.h>

fun(int n);
int main()
{
int n=10;
printf("%d",fun(10));
}
fun(int n)
{
if(n<1)
return n;
else
return (n+fun(n-1));
}
 
Is This Answer Correct ?    5 Yes 7 No
Arunkumar
 
Answer
# 6
void main()
{
int a,n,i,sum=0;
printf("enter n value");
scanf("%d",&n);
printf("\n Enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
sum+=a[i];
printf("\nSum of the given numbers is %d",sum);
}
 
Is This Answer Correct ?    9 Yes 12 No
Neha Shree
 
Answer
# 7
here the program uses dynamic memory allocation concept instead of arraya......


#include<stdio.h>
#include<conio.h>
void main()
{
int *pointer,n,sum=0;
clrscr();
printf("enter no. of elements :");
scanf("%d",&n);
pointer=(int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
{
scanf("%d",(pointer+i));
sum=sum+(*(pointer+i));
}
printf("the sum is :%d",sum);
getch();
}


thank u
 
Is This Answer Correct ?    11 Yes 17 No
Vignesh1988i
 
Answer
# 8
#include<stdio.h>
#include<conio.h>
int main()
{
int n,m,m1,s=0,d,sum;
printf("\nEnter the number ");
scanf("%d",&n);
m=n%10;
d=n/10;
while(d>=10)
{
m1=d%10;
d=d/10;
s =s+m1;
}
sum=s+m+d;
printf("\nSum is %d",sum);
getch();
}
 
Is This Answer Correct ?    4 Yes 15 No
Ruchi
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What are advantages and disadvantages of recursive calling ? HP 11
Write a program that takes a 5 digit number and calculates 2 power that number and prints it   7
#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?   3
What is the most efficient way to count the number of bits which are set in a value?   4
wht is the difference between KPO and BPO ? BPO 2
who developed c and why he developed c?   5
difference between loading and linking   1
input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure IBM 4
4.A function 'q' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as: A)int (*q(char*)) [] B)int *q(char*) [] C)int(*q)(char*) [] D)None of the Above Accenture 6
What is the output of the following progarm? #include<stdio.h> main( ) { int x,y=10; x=4; y=fact(x); printf(%d\n,y); } unsigned int fact(int x) { return(x*fact(x-1)); } A. 24 B. 10 C. 4 D. none   2
What does a run-time "null pointer assignment" error mean?   2
write a program for size of a data type without using sizeof() operator? IBM 21
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com