Computer Science, asked by Harshrajesh7350, 1 year ago

How many times will "Tricky!" be printed by the following loop?int c = 5; for (int i = 2; i <= c; i++) { for (int j = 0; j < i; j++) { System.out.println("Tricky!"); } }

Answers

Answered by zaidghori1997
3

14 times.

You can execute and count it or you can trace it manually and count it or you can count it directly. The "j" loop will run as many times as the "i" value. Since "i" value keeps changing, the end result is the summation of all i.e.,

2+3+4+5=14!

Similar questions