11111
22222
33333
44444
55555
22222
33333
44444
55555
Write a C program to print the pattern. or Write a program to print the pattern in C.
Code:
#include<stdio.h>
int main()
{
printf("Enter the row and column size:");
int row_size,out,in,p;
scanf("%d",&row_size);
for(out=1;out<=row_size;out++)
{
for(in=1;in<=row_size;in++)
printf("%d",out);
printf("\n");
}
}
int main()
{
printf("Enter the row and column size:");
int row_size,out,in,p;
scanf("%d",&row_size);
for(out=1;out<=row_size;out++)
{
for(in=1;in<=row_size;in++)
printf("%d",out);
printf("\n");
}
}
Input/Output:
Enter the row and column size:5
11111
22222
33333
44444
55555
Code:
11111
22222
33333
44444
55555
Write a C++ program to print the pattern . or Write a program to print the pattern in C++.
Code:
#include<iostream>
using namespace std;
int main()
{
cout<<"Enter the row and column size:";
int row_size,out,in,p;
cin>>row_size;
for(out=1;out<=row_size;out++)
{
for(in=1;in<=row_size;in++)
cout<<out;
cout<<"\n";
}
}
using namespace std;
int main()
{
cout<<"Enter the row and column size:";
int row_size,out,in,p;
cin>>row_size;
for(out=1;out<=row_size;out++)
{
for(in=1;in<=row_size;in++)
cout<<out;
cout<<"\n";
}
}
Input/Output:
Enter the row and column size:41111
2222
3333
4444
Write a JAVA program to print the pattern. or Write a program to print the pattern in Java.
Code:
import java.util.Scanner;
public class p8 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row and column size:");
int row_size,out,in;
row_size=cs.nextInt();
for(out=1;out<=row_size;out++)
{
for(in=1;in<=row_size;in++)
System.out.print(out);
System.out.println();
}
cs.close();
}
}
public class p8 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row and column size:");
int row_size,out,in;
row_size=cs.nextInt();
for(out=1;out<=row_size;out++)
{
for(in=1;in<=row_size;in++)
System.out.print(out);
System.out.println();
}
cs.close();
}
}
Input/Output:
Enter the row and column size:
6
111111
222222
333333
444444
555555
666666
6
111111
222222
333333
444444
555555
666666
Write a PYTHON to print the pattern. or Write a program to print the pattern in Python
Code:
print("Enter the row and column size:");
row_size=int(input())
for out in range(1,row_size+1):
for i in range(0,row_size):
print(out,end="")
print("\r")
row_size=int(input())
for out in range(1,row_size+1):
for i in range(0,row_size):
print(out,end="")
print("\r")
Input/Output:
Enter the row and column size:
5
11111
22222
33333
44444
55555
5
11111
22222
33333
44444
55555
0 Comments
Please do not Enter any spam link in the comment box