100% C Prog do ..while illustration
// program to print multiplication tables of given integers using do..while
#include <stdio.h>
void main()
{
int n,i,flag;
do
{
printf("\n enter a integer whose multiplication table is required:");
scanf("%d",&n);
for(i=1;i<11;i++)
{
printf("\n %3d * %2d= %3d",n,i,n*i);
}
printf("\n enter 0 to stop, else enter other number to continue:");
scanf("%d",&flag);
}while(flag);
}
4 * 1= 4
4 * 2= 8
4 * 3= 12
4 * 4= 16
4 * 5= 20
4 * 6= 24
4 * 7= 28
4 * 8= 32
4 * 9= 36
4 * 10= 40
enter 0 to stop, else enter other number to continue:5
enter a integer whose multiplication table is required:5
5 * 1= 5
5 * 2= 10
5 * 3= 15
5 * 4= 20
5 * 5= 25
5 * 6= 30
5 * 7= 35
5 * 8= 40
5 * 9= 45
5 * 10= 50
enter 0 to stop, else enter other number to continue:0
#include <stdio.h>
void main()
{
int n,i,flag;
do
{
printf("\n enter a integer whose multiplication table is required:");
scanf("%d",&n);
for(i=1;i<11;i++)
{
printf("\n %3d * %2d= %3d",n,i,n*i);
}
printf("\n enter 0 to stop, else enter other number to continue:");
scanf("%d",&flag);
}while(flag);
}
ఔట్పుట్ ఈ కింది విధంగా కనపడును..
enter a integer whose multiplication table is required:44 * 1= 4
4 * 2= 8
4 * 3= 12
4 * 4= 16
4 * 5= 20
4 * 6= 24
4 * 7= 28
4 * 8= 32
4 * 9= 36
4 * 10= 40
enter 0 to stop, else enter other number to continue:5
enter a integer whose multiplication table is required:5
5 * 1= 5
5 * 2= 10
5 * 3= 15
5 * 4= 20
5 * 5= 25
5 * 6= 30
5 * 7= 35
5 * 8= 40
5 * 9= 45
5 * 10= 50
enter 0 to stop, else enter other number to continue:0
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.