Code Box
------------------------------------------
/*program to print number pattern by do while loop
5
54
543
5432
54321
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
clrscr();
printf("\nEnter a value: ");
scanf("%d",&n);
i=n;
do
{j=n;
do
{
printf("%d",j);
j--;
}
while(j>=i);
printf("\n");
i--;
}
while(i>=1);
getch();
}
------------------------------------------
/*program to print number pattern by do while loop
5
54
543
5432
54321
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
clrscr();
printf("\nEnter a value: ");
scanf("%d",&n);
i=n;
do
{j=n;
do
{
printf("%d",j);
j--;
}
while(j>=i);
printf("\n");
i--;
}
while(i>=1);
getch();
}
No comments:
Post a Comment