0% found this document useful (0 votes)
12 views1 page

Invertible Pyramid

Uploaded by

adinrose06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Invertible Pyramid

Uploaded by

adinrose06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

*;

class INVERTEDHALFPYRAMIDwithNumberspatternUsingNestedLoop
{
int line;

public INVERTEDHALFPYRAMIDwithNumberspatternUsingNestedLoop()
{
line=0;
}

public void AssigningValToLine()


{
Scanner Sc = new Scanner(System.in);

System.out.println("ENTER VAL IN LINE");


line=Sc.nextInt();
Sc.close();
}

public void PrintingHalfStarPattern()


{
for(int i=5; i>=line; i--)
{

for(int j=1; j<=i; j++)


{
System.out.print(j);

}
System.out.println();
}
}

public static void main(String args[])


{
INVERTEDHALFPYRAMIDwithNumberspatternUsingNestedLoop obj = new
INVERTEDHALFPYRAMIDwithNumberspatternUsingNestedLoop();

obj.AssigningValToLine();
obj.PrintingHalfStarPattern();
}

You might also like