Computer Science, asked by prathmeshwadile2281, 1 month ago

write a program to print following output in java?
Sample Input 1 :
3
Sample Output 1 :
1=1
1+2=3
1+2+3=6
Sample Input 2 :
5
Sample Output 2 :
1=1
1+2=3
1+2+3=6
1+2+3+4=10
1+2+3+4+5=15

Answers

Answered by sh76489zhjva
1

Explanation:

public class KboatPattern { public void displayPattern() { for (int i = 1; i < 10; i = i + 2) { for (int j = i; j > 0; j = j - 2) { System.out.print(j + " "); } System.out.println(); } } }

Similar questions