In this article i write examples Looping Program
Example 1 :
Looping use For
#include <conio.h>
#include <iostream.h>
void main()
{
int x;
clrscr();
for(x=1;x<=10;x++)
{
cout<<x;
}
getch();
}
Example 2 :
Looping use While
#include <conio.h>
#include <iostream.h>
void main()
{
int x;
clrscr();
x=1;
while(x<=10)
{
cout<<x;
x++;
}
getch();
}
Example 3 :
Looping use Do While
#include <conio.h>
#include <iostream.h>
void main()
{
int x;
clrscr();
x=1;
do
{
cout<<x;
x++;
}while(x==10);
getch();
}
Example 1 :
Looping use For
#include <conio.h>
#include <iostream.h>
void main()
{
int x;
clrscr();
for(x=1;x<=10;x++)
{
cout<<x;
}
getch();
}
Example 2 :
Looping use While
#include <conio.h>
#include <iostream.h>
void main()
{
int x;
clrscr();
x=1;
while(x<=10)
{
cout<<x;
x++;
}
getch();
}
Example 3 :
Looping use Do While
#include <conio.h>
#include <iostream.h>
void main()
{
int x;
clrscr();
x=1;
do
{
cout<<x;
x++;
}while(x==10);
getch();
}
Comments
Post a Comment