Making a table of converting Miles to Kilometers, completely lost

2. Write a program that: (Use logical operators || && to combine two condition checks in one if
statement)
 Asks the user to enter an integer that is greater than 0 and less than 20
 If the entered number is not within the range the program keeps on asking for a valid number
 Otherwise the program prints a table converting miles to kilometers from 1 to the user entered
number
Ex:
Enter an integer that is greater than 0 and less than 20: 22
Enter an integer that is greater than 0 and less than 20: 10
(Note: You can use tab ‘\t’ to line up nicely)

Miles Kilometers
1 1.609
2 3.218

10 16.090
Let's see what code you've written so far.

Knowledge in the following is required for this project:

1.) Loops (while, for)
2.) Logical operators
3.) Asking for user input
4.) Printing to the console

Which part has you completely lost?
Last edited on
Topic archived. No new replies allowed.