****1
***2
**3
*4
5
Write a program in java to print the above pattern
Please answer
Answers
Answered by
2
Question:-
- Java code to print the following pattern
****1
***2
**3
*4
5
Code:-
package coder;
class Patt2
{
public static void main (String ar [])
{
/*code written by:-
*@swetank232894
*/
for(int i=1;i<=5;i++)
{
for(int j=5;j>=i;j--)
{
if(j==i)
System.out.print(i);
else
System.out.print("*");
}
System.out.println();
}
}
}
Variable Description:-
- i:- loop variable
- j:- loop variable
•Output Attached
Attachments:
Similar questions