Write a C Program
Write a C program to print the following output? 55555 4444 333 22 1
Answers
Answered by
0
#include<stdio.h>
void main()
{
int a,b;
clrscr();
for(a=5;a>=1;a--)
{
for(b=1;b<=a;b++)
{
printf("%d",a);
}
}
getch();
}
output of the program is
555554444333221
void main()
{
int a,b;
clrscr();
for(a=5;a>=1;a--)
{
for(b=1;b<=a;b++)
{
printf("%d",a);
}
}
getch();
}
output of the program is
555554444333221
Answered by
0
Answer:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=5;i>0;i--)
{
for(int j=0;j<=i; j++)
{
cout<<i;
}
cout<<endl;
}
getch();
}
Output will be...
55555
4444
333
22
1
Similar questions