Write a program to print the following pattern- 1)55555 54444 54333 54322 54321
Answers
Answered by
1
#include <stdio.h>
#include<conio.h>
void main()
{
int a, b, c, d;
clrscr();
printf("Enter rows: ");
scanf("%d", &a);
printf("Enter columns: ");
scanf("%d", &b);
printf("\n");
for(c=1; c<=a; c++)
{
for(d=b; d>b-c; d--)
{
printf("%d", d);
}
for(d=1; d<=b-c; d++)
{
printf("%d", (a - c + 1));
}
printf("\n");
printf("\n");
}
getch();
}
Hope this helps!
#include<conio.h>
void main()
{
int a, b, c, d;
clrscr();
printf("Enter rows: ");
scanf("%d", &a);
printf("Enter columns: ");
scanf("%d", &b);
printf("\n");
for(c=1; c<=a; c++)
{
for(d=b; d>b-c; d--)
{
printf("%d", d);
}
for(d=1; d<=b-c; d++)
{
printf("%d", (a - c + 1));
}
printf("\n");
printf("\n");
}
getch();
}
Hope this helps!
Similar questions
Physics,
8 months ago
Biology,
8 months ago
Hindi,
8 months ago
Hindi,
1 year ago
Social Sciences,
1 year ago