Read OnLine C- Program Example

04_LOOP CONCEPT (03_DO WHILE LOOP)
PRAC 1 PRAC 2
//wap to print 1to10 number
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
i=1;
do
{
printf("%d \n",i);
i++;
}
while (i<=10);
getch();
-------output------
}
1
2
3
4
5
6
7
8
9
10
//wap to print 10to1 number
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
i=10;
do
{
printf("%d \n",i);
i--;
}
while (i>=1);
getch();
}
------output------
10
9
8
7
6
5
4
3
2
1
Previous Next
Download Download