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   interview questions urls   External Links  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  >>  ERRORS  >>  C C++ Errors
 
 


 

 
 C C++ Errors interview questions  C C++ Errors Interview Questions
 DotNet Errors interview questions  DotNet Errors Interview Questions
 Database Errors interview questions  Database Errors Interview Questions
 Scripts Errors interview questions  Scripts Errors Interview Questions
Question
To generate the series 1+3+5+7+... using C program
 Question Submitted By :: S.vyasaraj
I also faced this Question!!     Rank Answer Posted By  
 
  Re: To generate the series 1+3+5+7+... using C program
Answer
# 1
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1,sum=0;
clrscr();
printf("enter the value for n:");
scanf("%d",&n);
while(i<=n)
{
sum=sum+i;
i=i+2;
}
printf("the series is =%d");
getch()
}
 
Is This Answer Correct ?    1 Yes 0 No
S.vyasaraj
 
  Re: To generate the series 1+3+5+7+... using C program
Answer
# 2
the series seems to be infinite . so you need to restrict 
it to some ceiling.
 
Is This Answer Correct ?    0 Yes 0 No
Parthibanselvaraj
[Tessolve Services Pvt Ltd]
 
 
 
  Re: To generate the series 1+3+5+7+... using C program
Answer
# 3
In the answer Printf function is worng here the value for %
d is not mentioned it would like

printf("the series is =%d", sum);
 
Is This Answer Correct ?    0 Yes 0 No
Naresh Kumar
 
  Re: To generate the series 1+3+5+7+... using C program
Answer
# 4
#include"stdio.h"
#include"conio.h"
void main()
{
int s=0;
for(int i=1;i<100;i++)
{
if(i%2==0)
continue;
s=s+i;
}
printf("The answer is...%d",s);
getch();
}
 
Is This Answer Correct ?    0 Yes 0 No
Mariaalex007
[PSNCET]
 

 
 
 
Other C C++ Errors Interview Questions
 
  Question Asked @ Answers
 
loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program. CMC3
UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....  2
printy(a=3,a=2)  3
Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .  1
write a profram for selection sort whats the error in it?  1
void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?..  3
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .  1
who was the present cheif governor of reserve bank of india SBI1
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?  5
To generate the series 1+3+5+7+... using C program  4
 
For more C C++ Errors Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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