Tuesday, 29 March 2016

Write a Program to print even nos upto 100 using for loop in c++ language.

//wap  to print even nos up to 100 using for loop in c++ language.
#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();

int a;
cout<<"Even nos are:"<<endl;
for(a=1;a<=100;a++)
{
if(a%2==0)
{
cout<<a<<" ";
}
}
getch();
}

Output:-
               

No comments:

Post a Comment