write a program in Java to print series 5 55 555 5555 55555 555555
Answers
Answered by
22
Answer:
follow these steps ........ hope this will help u........plz mark it as a brilliant ans
Attachments:
Answered by
12
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
}
}
}
Description of the above java program as follows:
- In the above java program, a class that is Pattern is defined that contains the main method, inside the main method, two integer variable is declared that is x, and y, in which variable x is for print rows and variable y is used for print columns.
- In this program two for loop is defined that is also known as nested loop, inside a loop both integer variable is used that print the given series.
Learn More:
- Pattern in java : https://brainly.in/question/6773823
- Number series in java: https://brainly.in/question/7783188
Similar questions