PatternPrinting-1

 Pattern1


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 =0; i<numbers; i++)
		{
			for(j =0 ; j<numbers; j++)
			{
				printf("* ");
			}
			printf("\n");
		}
}




Java Program
import java.util.Scanner;

public class Pattern_1 {

	public static void main(String[] args) {
		Scanner S = new Scanner(System.in);
		int numbers;
		System.out.println("Enter the Number of rows:");
		numbers = S.nextInt();
		for(int i =0; i<numbers; i++ )
		{
			for(int j =0 ; j<numbers; j++)
			{
				System.out.print("* ");
			}
			System.out.print("\n");
		}
   }
}


Python Program
n = int(input("Enter Number of rows: "))
for i in range(n):
    for j in range(n):
        print("*", end=" ")
    print(" ")

0 Comments:

Post a Comment