Sunday, 21 July 2013

Even Numbers in Ascending Order

// Write a C++ program that prints even numbers in
// ascending order up to given range.


#include<iostream.h>
#include<conio.h>
void main()
{
    clrscr();
    int i,n;
    cout<<"Enter any number for ending range : ";
    cin>>n;
   
    cout<<"\n\n------------------------------------\n";
    cout<<" Even numbers in Ascending Order \n";
    cout<<"------------------------------------\n";

    for( i = 0 ; i <= n ; i = i+2 )
    cout<<"         "<<i<<endl;
    getch();
}

No comments:

Post a Comment