Print the series 5 55 555 5555 55555 555555 without nested for loop?
Answers
Answered by
1
Answer:
Program in Java to print series 5 55 555 5555 55555 555555
Output:
5 55 555 5555 55555 555555
Explanation:
Program in java to print given series:
Program:
public class Pattern //defining class Pattern
{
public static void main(String[] a) //defining main method
{
int x,y; //declaring variable
for (x = 1; i <= 6; i++) //loop for rows
{
for ( y = 1; j <= i; j++) //loop for columns
{
System.out.print("5"); //print value.
}
System.out.print(" "); //print space
}
}
}
Similar questions