A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
Input/Output:
Input/Output:
Enter the row and column size:D
A B C D
A B C D
A B C D
A B C D
Input/Output:
A B C D E
A B C D E
A B C D E
A B C D E
Write a C program to print the pattern.
Code:
#include<stdio.h>
int main()
{
printf("Enter the row and column size:");
int out,in;
char row_size;
scanf("%c",&row_size);
for(out='A';out<=row_size;out++)
{
for(in='A';in<=row_size;in++)
printf("%c ",in);
printf("\n");
}
}
int main()
{
printf("Enter the row and column size:");
int out,in;
char row_size;
scanf("%c",&row_size);
for(out='A';out<=row_size;out++)
{
for(in='A';in<=row_size;in++)
printf("%c ",in);
printf("\n");
}
}
Input/Output:
Enter the row and column size:E
A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
Write a C++ program to print the pattern
A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
Write a C++ program to print the pattern
Code:
#include<iostream>
using namespace std;
int main()
{
cout<<"Enter the row and column size:";
int out,in;
char row_size;
cin>>row_size;
for(out='A';out<=row_size;out++)
{
for(in='A';in<=row_size;in++)
cout<<char(in)<<" ";
cout<<"\n";
}}
using namespace std;
int main()
{
cout<<"Enter the row and column size:";
int out,in;
char row_size;
cin>>row_size;
for(out='A';out<=row_size;out++)
{
for(in='A';in<=row_size;in++)
cout<<char(in)<<" ";
cout<<"\n";
}}
Input/Output:
A B C D
A B C D
A B C D
A B C D
Write a program to print the pattern in Java.
Code:
import java.util.Scanner;
public class p13 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row and column size:");
char out,in;
char row_size=cs.next().charAt(0);
for(out='A';out<=row_size;out++)
{
for(in='A';in<=row_size;in++)
System.out.print(in+" ");
System.out.println();
}
cs.close();
}
}
public class p13 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row and column size:");
char out,in;
char row_size=cs.next().charAt(0);
for(out='A';out<=row_size;out++)
{
for(in='A';in<=row_size;in++)
System.out.print(in+" ");
System.out.println();
}
cs.close();
}
}
Input/Output:
Enter the row and column size:
E
A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
E
A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
Write a PYTHON to print the pattern.
Code:
Code:
print("Enter the row and column size:");
row_size=input()
for out in range(ord('A'),ord(row_size)+1):
for i in range(ord('A'),ord(row_size)+1):
print(chr(i),end=" ")
print("\r")
Enter the row and column size:
E
A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
0 Comments
Please do not Enter any spam link in the comment box