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