*********
*******
*****
***
*
Input Data:- row_size
Output Data:- *
Additional Data:-out, start_print, in or inn(for python)
Here is the source code of the C Program to Print the Inverted Full Pyramid Star Pattern.
Input/Output:
Code:
Input/Output:
Input/Output:
*******
*****
***
*
Problem Statement:- Program to Print the Inverted Full Pyramid Star Pattern.
Sample Input/Output:-
Data requirement:-
Input Data:- row_size
Output Data:- *
Additional Data:-out, start_print, in or inn(for python)
Program in C
Here is the source code of the C Program to Print the Inverted Full Pyramid Star Pattern.
Code:
#include<stdio.h>
int main()
{
printf("Enter the row size:");
int row_size;
scanf("%d",&row_size);
int star_print=row_size*2-1,in,out,p;
for(out=row_size;out>=1;out--)
{
for(in=row_size-1;in>=out;in--)
printf(" ");
for(p=1;p<=star_print;p++)
printf("*");
star_print-=2;
printf("\n");
}
}
int main()
{
printf("Enter the row size:");
int row_size;
scanf("%d",&row_size);
int star_print=row_size*2-1,in,out,p;
for(out=row_size;out>=1;out--)
{
for(in=row_size-1;in>=out;in--)
printf(" ");
for(p=1;p<=star_print;p++)
printf("*");
star_print-=2;
printf("\n");
}
}
Input/Output:
Enter the row size:5
*********
*******
*****
***
*
Program in C++
Here is the source code of the C++ Program to Print the Inverted Full Pyramid Star Pattern.
*********
*******
*****
***
*
Program in C++
Here is the source code of the C++ Program to Print the Inverted Full Pyramid Star Pattern.
Code:
#include<iostream>
using namespace std;
int main()
{
cout<<"Enter the row size:";
int row_size;
cin>>row_size;
int star_print=row_size*2-1,in,out,p;
for(out=row_size;out>=1;out--)
{
for(in=row_size-1;in>=out;in--)
cout<<" ";
for(p=1;p<=star_print;p++)
cout<<"*";
star_print-=2;
cout<<"\n";
}
}
using namespace std;
int main()
{
cout<<"Enter the row size:";
int row_size;
cin>>row_size;
int star_print=row_size*2-1,in,out,p;
for(out=row_size;out>=1;out--)
{
for(in=row_size-1;in>=out;in--)
cout<<" ";
for(p=1;p<=star_print;p++)
cout<<"*";
star_print-=2;
cout<<"\n";
}
}
Input/Output:
Enter the row size:6
***********
*********
*******
*****
***
*
Program in Java
***********
*********
*******
*****
***
*
Program in Java
Here is the source code of the Java Program to Print the Inverted Full Pyramid Star Pattern.
Code:
import java.util.Scanner;
public class StarPattern10 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row size:");
int row_size=cs.nextInt();
int star_print=row_size*2-1;
for(int out=row_size;out>=1;out--)
{
for(int in=row_size-1;in>=out;in--)
System.out.printf(" ");
for(int p=1;p<=star_print;p++)
System.out.printf("*");
star_print-=2;
System.out.println();
}
cs.close();
}
}
Input/Output:public class StarPattern10 {
public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
System.out.println("Enter the row size:");
int row_size=cs.nextInt();
int star_print=row_size*2-1;
for(int out=row_size;out>=1;out--)
{
for(int in=row_size-1;in>=out;in--)
System.out.printf(" ");
for(int p=1;p<=star_print;p++)
System.out.printf("*");
star_print-=2;
System.out.println();
}
cs.close();
}
}
Enter the row size:
4
*******
*****
***
*
4
*******
*****
***
*
Program in Python
Here is the source code of the Program to Print the Inverted Full Pyramid Star Pattern.
Code:
row_size=int(input("Enter the row size:"))
star_print=row_size*2-1
for out in range(row_size,0,-1):
for inn in range(row_size,out,-1):
print(" ",end="")
for p in range(0,star_print):
print("*",end="")
star_print-=2
print("\r")
star_print=row_size*2-1
for out in range(row_size,0,-1):
for inn in range(row_size,out,-1):
print(" ",end="")
for p in range(0,star_print):
print("*",end="")
star_print-=2
print("\r")
Input/Output:
Enter the row size:8
***************
*************
***********
*********
*******
*****
***
*
More:-
***************
*************
***********
*********
*******
*****
***
*
More:-
0 Comments
Please do not Enter any spam link in the comment box