Interview Questions   Tutorials   Discussions   Programs   Videos   

C++ - Write program to print first nodd numbers in descending order.




3810
views
asked marvit August 18, 2014 11:22 AM  

Write program to print first nodd numbers in descending order.


           

1 Answers



 
answered By bhjahnavi   0  
/* program to print first n odd numbers in descending order*/
#include<iostream.h>       
#include<conio.h>       
using namespace std;     
void main()
{
clrscr();               
int n,i=1;               
cout<<"Enter max. limit to which you like to print odd number:";
cin>>n;                
while(i<=n)
{
cout<<i<<",";          
i+=2;                  
}
getche();               
}
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert