Write a C Program to Program to print the Full Pyramid Number Pattern.
1333
55555
7777777
999999999
Problem statement:- Program to print the Inverted Full Number Pattern
Data requirement:-
Input Data:- row_size
Output Data:- np
Additional Data:-in1, out, in2
Program in C
Here is the source code of the C Program to print the Full Pyramid Number Pattern.
#include <stdio.h>
int main()
{
printf("Enter the row size:");
int row_size,out,in1,in2;
int np=1;
scanf("%d",&row_size);
for(out=0;out<row_size;out++)
{
for(in1=row_size-1;in1>out;in1--)
{
printf(" ");
}
for(in2=0;in2<np;in2++)
{
printf("%d",np);
}
np+=2;
printf("\n");
}
}
Input/Output:int main()
{
printf("Enter the row size:");
int row_size,out,in1,in2;
int np=1;
scanf("%d",&row_size);
for(out=0;out<row_size;out++)
{
for(in1=row_size-1;in1>out;in1--)
{
printf(" ");
}
for(in2=0;in2<np;in2++)
{
printf("%d",np);
}
np+=2;
printf("\n");
}
}
Enter the row size:5
1
333
55555
7777777
999999999
Write a C++ Program to print the Full Pyramid Number Pattern.
Program in C++
Here is the source code of the C++ Program to print the Full Pyramid Number Pattern.
#include <iostream>
using namespace std;
int main()
{
cout<<"Enter the row size:";
int row_size,out,in1,in2;
int np=1;
cin>>row_size;
for(out=0;out<row_size;out++)
{
for(in1=row_size-1;in1>out;in1--)
{
cout<<" ";
}
for(in2=0;in2<np;in2++)
{
cout<<np;
}
np+=2;
cout<<"\n";
}
}
Input/Output:using namespace std;
int main()
{
cout<<"Enter the row size:";
int row_size,out,in1,in2;
int np=1;
cin>>row_size;
for(out=0;out<row_size;out++)
{
for(in1=row_size-1;in1>out;in1--)
{
cout<<" ";
}
for(in2=0;in2<np;in2++)
{
cout<<np;
}
np+=2;
cout<<"\n";
}
}
Enter the row size:4
1
333
55555
7777777
Write a Java Program to print the Full Pyramid Number Pattern.
Program in Java
Here is the source code of the Java Program to print the Full Pyramid Number Pattern.
import java.util.Scanner;
public class P32 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row size:");
int row_size,out,in1,in2;
int np=1;
row_size=cs.nextInt();
for(out=0;out<row_size;out++)
{
for(in1=row_size-1;in1>out;in1--)
{
System.out.print(" ");
}
for(in2=0;in2<np;in2++)
{
System.out.print(np);
}
np+=2;
System.out.println();
}
cs.close();
}
}
Input/Output:public class P32 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row size:");
int row_size,out,in1,in2;
int np=1;
row_size=cs.nextInt();
for(out=0;out<row_size;out++)
{
for(in1=row_size-1;in1>out;in1--)
{
System.out.print(" ");
}
for(in2=0;in2<np;in2++)
{
System.out.print(np);
}
np+=2;
System.out.println();
}
cs.close();
}
}
Enter the row size:
3
1
333
55555
Write a Python Program to print the Full Pyramid Number Pattern.
Program in Python
Here is the source code of the Python Program to print the Full Pyramid Number Pattern.
row_size=int(input("Enter the row size:"))
np=1
for out in range(0,row_size):
for in1 in range(row_size-1,out,-1):
print(" ",end="")
for in2 in range(0, np):
print(np,end="")
np+=2
print("\r")
Input/Output:np=1
for out in range(0,row_size):
for in1 in range(row_size-1,out,-1):
print(" ",end="")
for in2 in range(0, np):
print(np,end="")
np+=2
print("\r")
Enter the row size:4
1
333
55555
7777777
0 Comments
Please do not Enter any spam link in the comment box