Pattern3
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 =1 ; i<=numbers; i++)
{
for(j=1; j<=numbers ; j++)
{
printf("%d ",j);
}
printf("\n");
}
}
Java Program
import java.util.Scanner;
public class Pattern_3 {
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 =0 ; i<n ; i++)
{
for(int j=1; j<=n;j++)
{
System.out.print(j+" ");
}
System.out.print("\n");
}
}
}
Python Program
n = int(input("Enter number of rows: "))
for i in range(n):
for j in range (n):
print(j+1, end=" ")
print(" ")
0 Comments:
Post a Comment