Computer Applications
Write a program to convert kilograms to pounds in the following tabular format (1 kilogram is 2.2 pounds):
Kilograms | Pounds |
---|---|
1 | 2.2 |
2 | 4.4 |
20 | 44.0 |
Java
Java Iterative Stmts
4 Likes
Answer
public class KboatKiloToPound
{
public static void main(String args[]) {
System.out.println("Kilograms \t Pounds");
for(int i = 1; i <= 20; i++) {
double p = i * 2.2;
System.out.println(i + "\t\t" + p);
}
}
}
Output
Answered By
3 Likes
Related Questions
Write a program using do-while loop to compute the sum of the first 500 positive odd integers.
Write a program in Java to read a number and display its digits in the reverse order. For example, if the input number is 2468, then the output should be 8642.
Output:
Enter a number: 2468
Original number: 2468
Reverse number: 8642Write a program that displays all the numbers from 150 to 250 that are divisible by 5 or 6, but not both.
Write three different programs using for, while, and do-while loops to find the product of series 3, 9, 12,… 30.