There is something wrong with my code. I need the code to print out 2.20 and 4.4
ID: 3811873 • Letter: T
Question
There is something wrong with my code. I need the code to print out 2.20 and 4.41 and so on.
My code
public class KillPounds {
public static void main(String args[]){
System.out.println("Kilograms Pounds");
for (int k = 1; k <=10; k++) {
System.out.printf(" %d %.2f ",k,(k/0.45));
if (k%5==0) {
System.out.println();
}
}
}
}
Explanation / Answer
>>>> Use the below code. Divide the number by 0.454. You will get the expected result. public class KillPounds { public static void main(String args[]){ System.out.println("Kilograms Pounds"); for (int k = 1; kRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.