Write a program to print the pattern

54321
54321
54321
54321
54321


Write a C program to print the pattern.

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=row_size;in>=1;in--)
    printf("%d",in);

        printf("\n");

  }
}


Input/Output:
Enter the row and column size:5
54321
54321
54321
54321
54321

Write a C++ program to print the pattern 

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=row_size;in>=1;in--)
    cout<<in;
        cout<<"\n";
  }
}


Input/Output:
Enter the row and column size:4
4321
4321
4321
4321

Write a program to print the pattern in Java.

Code:

import java.util.Scanner;
public class p11 {

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=row_size;in>=1;in--)
   System.out.print(in);

        System.out.println();

  }
cs.close();
}
}


Input/Output:
Enter the row and column size:
5
54321
54321
54321
54321
54321

Write a PYTHON Program to print the pattern. 

Code:

print("Enter the row and column size:")

row_size=int(input())
for out in range(row_size,0,-1):
    for i in range(row_size,0,-1):
        print(i,end="")

    print("\r")


Input/Output:
Enter the row and column size:
6
654321
654321
654321
654321
654321
654321

Post a Comment

0 Comments