print first nodd numbers in descending order

Answer Posted / nagarajan n.

int n;
cout<<"enter a num:";
cin>>n;
for(int i=n;i>=1;i--)
{
if((i%2)!=0)
{
cout<<i<<"/t";
}
}

Is This Answer Correct ?    50 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is computer programming useful in real life?

670


What is the difference between the compiler and the preprocessor?

720


Is c++ a good beginners programming language?

670


How do I run a program in notepad ++?

695


How do you save a c++ program?

657






Explain the difference between class and struct in c++?

672


Can a program run without main?

735


What is the hardest coding language to learn?

697


What are virtual functions in c++?

785


What header file is needed for exit(); a) stdlib.h b) conio.h c) dos.h

701


what is Loop function? What are different types of Loops?

735


What is the size of a vector?

674


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

708


Is linux written in c or c++?

662


What do you mean by translation unit in c++?

796