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 do c++ struct differs from the c++ class?

0 Answers  


What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00

0 Answers  


What is a concrete class?

1 Answers  


What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

0 Answers  


the first character in the variable name must be an a) special symbol b) number c) alphabet

0 Answers  


How would you call C functions from C++ and vice versa?

0 Answers   Genpact,


class Alpha { public: char data[10000]; Alpha(); ~Alpha(); }; class Beta { public: Beta() { n = 0; } void FillData(Alpha a); private: int n; }; How do you make the above sample code more efficient? a) If possible, make the constructor for Beta private to reduce the overhead of public constructors. b) Change the return type in FillData to int to negate the implicit return conversion from "int" to "void". c) Make the destructor for Alpha virtual. d) Make the constructor for Alpha virtual. e) Pass a const reference to Alpha in FillData

2 Answers   Quark,


Are there any new intrinsic (built-in) data types?

1 Answers  


check whether a no is prime or not.

3 Answers   TCS,


What are shallow and deep copy?

0 Answers  


a class that maintains a pointer to an object that is programatically accessible through the public interface is known as?

2 Answers   CTS,


What is atoi in c++?

0 Answers  


Categories