Convert Length
This
program converts measurements in feet and inches into centimeters using
the formula that 1 inch is equal to 2.54 centimeters. It uses the
following steps to come up with the final code solution.
- Problem Analysis and Algorithm Design
- Declaring Variables
- Stating Named Constant
4. Main Algorithm
- Putting it all together and producing final code
The main algorithm for this program is:
- Prompt the user for the input. (Without a prompt line, the user will stare at a blank screen and not know what to do.)
- Get feet.
- Prompt the user to enter a value for inches.
- Get inches.
- Echo the input—output what the program read as input. (Without this step, after the program has executed, you will not know what the input was.)
- Find the length in inches.
- Output the length in inches.
- Convert the length to centimeters.
- Output the length in centimeters.
Walang komento:
Mag-post ng isang Komento