In for loop how this second line works | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In for loop how this second line works

for (int x=0; x<3; x++){ amount = (int) (amount*90/100); } System.out.println(amount);

17th Oct 2021, 12:06 PM
naveen reddy
4 Answers
+ 3
<amount> will be assigned 90% of its own value, converted as `int`. What are you doing running that line in a loop though?
17th Oct 2021, 12:18 PM
Ipang
+ 2
(int)(...) - converts to integer
17th Oct 2021, 12:35 PM
Solo
Solo - avatar
+ 1
The program mentioned above I need to know where is the variable amount is declared and what is the initial value If the initial value is 0 The final result is also 0
19th Oct 2021, 7:15 AM
sree harsha
sree harsha - avatar
0
0 will be the out put naveen reddy
17th Oct 2021, 2:33 PM
Adithya Keshav T
Adithya Keshav T - avatar