Computer Science, asked by vidhitalwar60, 5 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 Deejumanna16
0

Answer:

Give the output of the given program segments:- [2 X 2 =4]

int x=10, s=0;

while(x>0)

{

System.out.print(x+” \t”);

s = s + x;

x = x - 2;

}

System.out.println();

System.out.println(s);

Answered by sameer7815
0

Explanation:

Output:

1

2

3

4

5

6

7

8

9

10

55

Similar questions