write a C++ programming :if the no is between 32 to 50 it
will be odd.

Answers were Sorted based on User's Feedback



write a C++ programming :if the no is between 32 to 50 it will be odd...

Answer / amit

void main()
{

int i,r;
for(i=32;i<=50;i++)
{
if(i%2!=0)
{
cout<<"odd"<<i
}
}

getch();
}

Is This Answer Correct ?    11 Yes 1 No

write a C++ programming :if the no is between 32 to 50 it will be odd...

Answer / debotri das

#include<iostream.h>
#include<conio.h>
void main()
{
int i=32;
clrscr();
while(i<=50)
{
if(i%2==0)
cout<<i<<"\n";
i++;
}
getch();
}

Is This Answer Correct ?    8 Yes 1 No

write a C++ programming :if the no is between 32 to 50 it will be odd...

Answer / devi

#include<iostream.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=32;i<=50;i++)
{
if(i%2==1)
{
cout<<"Odd Number is:"<<i<<endl;
}
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C++ General Interview Questions

How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

0 Answers  


What is the maximum combined length of command line arguments including the space between adjacent arguments?

0 Answers  


What does iomanip mean in c++?

0 Answers  


what is an array

17 Answers  


Consider a c++ template funtion template<class T> T& Add(T a, T b){return a+b ;} if this function is called as T c = Add("SAM", "SUNG"); what will happen? What is the problem in the template declaration/ How to solve the problem.

7 Answers   LG, Samsung,






What are the rules about using an underscore in a c++ identifier?

0 Answers  


What is prototype for that c string function?

0 Answers  


How many types of classes are there in c++?

0 Answers  


Should I learn c or c++ or c#?

0 Answers  


What is dangling pointers?and what is memory leak?

5 Answers  


What is binary search in c++?

0 Answers  


Can I learn c++ without knowing c?

0 Answers  


Categories