0 تصويتات
بواسطة
int y = 0;
for (int i = 0; i<10; ++i) {
y += i;
}
System.out.println(y);

1 إجابة واحدة

0 تصويتات
بواسطة
The output of this code is 45.
Explanation:
The code initializes an integer variable y to 0. It then enters a for loop that starts with i=0 and continues as long as i is less than 10. In each iteration of the loop, the value of i is added to the variable y. After the loop completes, the value of y is printed, which is the sum of numbers from 0 to 9 (0+1+2+3+4+5+6+7+8+9), which equals 45.
مرحبًا بك إلى يزيد، حيث يمكنك طرح الأسئلة وانتظار الإجابة عليها من المستخدمين الآخرين.

اسئلة متعلقة

...