Computer Science, asked by bhandarikshitij4, 3 months ago

Question 2: Display the output of the following segment :
a) int sum=0;
for(int i=1;i<=10;i++)
System.out.println (i);
sum=sum+i;
System.out.println(sum);​

Answers

Answered by uzmaahmed246
0

Answer:

1

1

2

3

3

6

4

10

5

15

6

21

7

28

8

36

9

45

10

55

the value of i will increase after every loop and get printed and each value will be add with the previous value of sum and will be printed

Similar questions