0

Using code to solve a maths question but can’t get it right

trying to use code to solve the question below: From 2023 subtract half of it at first, then subtract 1/3 of the remaining number, next subtract 1/4 of the remaining number, and so on, until 1/2023 of the remaining number is subtracted. What is the final number? A. 1/2023. B.2/2023. C.3/2023. D.1. E.2. Any help? Public class Calculate(){ public static void main(String
args){ int a = 2023; int b =1; int c =2; double d=0d; double result=d; if(c=2023){ } } Beginner

23rd Oct 2022, 5:46 PM
đ•†đ•œđ•šđ•œđ•šđ• đ•đ•’đŸŒ»
đ•†đ•œđ•šđ•œđ•šđ• đ•đ•’đŸŒ» - avatar
3 RĂ©ponses
0
There are many ways you could do this. You could use a for, do/while or a while loop. Something like... While c != 2023 D = a - (a/c) C++ A = d
23rd Oct 2022, 8:26 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Ohh, thats true, kotlin do/while, thanks but dont know if i will get the right code buh i will try to figure it out later
23rd Oct 2022, 11:14 PM
đ•†đ•œđ•šđ•œđ•šđ• đ•đ•’đŸŒ»
đ•†đ•œđ•šđ•œđ•šđ• đ•đ•’đŸŒ» - avatar
0
If you need more help after you've tried, save your code in the code playground and attach it here.
24th Oct 2022, 7:03 AM
Ausgrindtube
Ausgrindtube - avatar