Back to Home & C
A ))) //Program to print numbers upto 20 using While loop
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=0;
while(i<=20)
{
printf("%d\n\n",i);
i++;
}
getch();
}
---------------------------------------------------------
Output
0
1
2
..
..
20
===============================================
//Program to print the numbers from 100 to 60 using do-while loop
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=100;
do
{
printf("%d\n",i);
i--;
}
while(i>=60);
getch();
}
Back to Home & C
A ))) //Program to print numbers upto 20 using While loop
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=0;
while(i<=20)
{
printf("%d\n\n",i);
i++;
}
getch();
}
---------------------------------------------------------
Output
0
1
2
..
..
20
===============================================
B ))) //Program to print numbers from 20 to 1 using While loop
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=20;
while(i>0)
{
printf("%d\n\n",i);
i--;
}
getch();
}
---------------------------------------------------------
Output
20
19
18
..
..
2
1
===============================================
C ))) //Program to print numbers from 100 to 60 using Do-While loop//Program to print the numbers from 100 to 60 using do-while loop
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=100;
do
{
printf("%d\n",i);
i--;
}
while(i>=60);
getch();
}
---------------------------------------------------------
Output
100
99
98
..
..
61
60
===============================================
No comments:
Post a Comment