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
3 Answers
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
+ 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
0
If you need more help after you've tried, save your code in the code playground and attach it here.