zadanie"Kontrola wagi ciala" ma złe elementy do automatycznego wprowadzenia ( na androidzie ) . Trzeba recznie wprowadzic tekst jaki ma sie pojawic na wyjsciu dla przypadku wagi "normalna" i "nadwaga".
Why does the percent(4,8) method return wrong results for arguments 4 and 8?
public static double percent(int a, int b) {
//tutaj wpisz swój kod
return (a * b * 1.0) / 100;
}
public static void main(String[] args) {
System.out.println(Kalkulator.divide(4, 8));
System.out.println(Kalkulator.percent(4, 8));
}
result: 0.32
correct should be: 0.5
for example for percent(5,10) = 0.5 works correctly.
for percent (3,6) = 0.18 WRONG again
any ideas?
Witam Mam problem z dzieleniem ost zadanie:
double wynik = (double)b/a;
wynik *= 100;
i powinno śmigać lecz w tym przypadku nie czy coś robię zle?
w teorii, jeśli dzielisz int przez int to bd int natomiast, jestli dzielisz double przez int będzie double.
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.
GO TO FULL VERSION