Pattern5
C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int numbers,i,j;
printf("Enter the Number of rows:");
scanf("%d",&numbers);
for(i =numbers ; i>=1; i--)
{
for(j=0; j<numbers ; j++)
{
printf("%d ",i);
}
printf("\n");
}
}
Java Program
import java.util.Scanner;
public class Pattern_5 {
public static void main(String[] args) {
Scanner S = new Scanner(System.in);
System.out.println("Enter The Number of Rows");
int n = S.nextInt();
for(int i = n; i>=1; i--)
{
for(int j=0; j<n; j++)
{
System.out.print(i + " ");
}
System.out.print("\n");
}
}
}
Python Program
n = int(input("Enter number of rows: "))
k=n
for i in range(n):
for j in range(n):
print(k, end= " ")
print(" ")
k=k-1
0 Comments:
Post a Comment