55555
44444
33333
22222
11111
Code:
666666
555555
444444
333333
222222
111111
Input/Output:
Code:
44444
33333
22222
11111
Write a C program to print the pattern. or Write a program to print the pattern in C.
Code:
#include<stdio.h>
int main()
{
printf("Enter the row and column size:");
int row_size,out,in,p;
scanf("%d",&row_size);
for(out=row_size;out>=1;out--)
{
for(in=1;in<=row_size;in++)
printf("%d",out);
printf("\n");
}
}
int main()
{
printf("Enter the row and column size:");
int row_size,out,in,p;
scanf("%d",&row_size);
for(out=row_size;out>=1;out--)
{
for(in=1;in<=row_size;in++)
printf("%d",out);
printf("\n");
}
}
Input/Output:
Enter the row and column size:5
55555
44444
33333
22222
11111
55555
44444
33333
22222
11111
Write a C++ program to print the pattern. or Write a program to print the pattern in C++.
Code:
#include<iostream>
using namespace std;
int main()
{
cout<<"Enter the row and column size:";
int row_size,out,in,p;
cin>>row_size;
for(out=row_size;out>=1;out--)
{
for(in=1;in<=row_size;in++)
cout<<out;
cout<<"\n";
}
}
using namespace std;
int main()
{
cout<<"Enter the row and column size:";
int row_size,out,in,p;
cin>>row_size;
for(out=row_size;out>=1;out--)
{
for(in=1;in<=row_size;in++)
cout<<out;
cout<<"\n";
}
}
Input/Output:
Enter the row and column size:6666666
555555
444444
333333
222222
111111
Write a JAVA program to print the pattern. or Write a program to print the pattern in Java.
Code:
import java.util.Scanner;
public class p10 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row and column size:");
int row_size,out,in;
row_size=cs.nextInt();
for(out=row_size;out>=1;out--)
{
for(in=1;in<=row_size;in++)
System.out.print(out);
System.out.println();
}
cs.close();
}
}
public class p10 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row and column size:");
int row_size,out,in;
row_size=cs.nextInt();
for(out=row_size;out>=1;out--)
{
for(in=1;in<=row_size;in++)
System.out.print(out);
System.out.println();
}
cs.close();
}
}
Input/Output:
Enter the row and column size:
4
4444
3333
2222
1111
4
4444
3333
2222
1111
Write a PYTHON to print the pattern. or Write a program to print the pattern in Python.
Code:
row_size = int(input("Enter the row and column size:"))for out in range(row_size, 0, -1): for i in range(0, row_size): print(out, end="") print("\r")
Input/Output:
Enter the row and column size:
5
55555
44444
33333
22222
11111
5
55555
44444
33333
22222
11111
0 Comments
Please do not Enter any spam link in the comment box