Question: Chapter 5 1. Write a program that asks the user for a 24-hour time, then displays the time in 12-hour form: Enter a 24-hour time:
Chapter 5
1. Write a program that asks the user for a 24-hour time, then displays the time in 12-hour form:
Enter a 24-hour time: 21:11
Equivalent 12-hour time: 9:11 PM
Be careful not to display 12:00 as 0:00.
1. Write your program here:
#include
int main(){
return 0;
}
2. Heres a simplified version of the Beaufort scale, which is used to estimate wind force:
| Speed (knots) | Description |
| Less than 1 | Calm |
| 1~3 | Light air |
| 4~27 | Breeze |
| 28~47 | Gale |
| 48~63 | Storm |
| Above 63 | Hurricane |
Write a program that asks the user to enter a wind speed (in knots), then displays the corresponding description.
2. Write your program here:
#include
int main(){
return 0;
}
3. Write a program that finds the largest and smallest of four integers entered by the user:
Enter four integers: 21 43 10 35
Largest: 43
Smallest: 10
Use as few if statements as possible. Hint: Four if statements are sufficient.
3. Write your program here:
#include
int main(){
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
