1
|
Write a program that takes length as input in feet and inches. The program should then convert the lengths in centimeters and display it on screen. Assume that the given lengths in feet and inches are integers.
Based on the problem, you need to design an algorithm as follows:
1. Get the length in feet and inches. 2. Convert the length into total inches. 3. Convert total inches into centimeters. 4. Output centimeters.
To calculate the equivalent length in centimeters, you need to multiply the total inches by 2.54. Instead of using the value 2.54 directly in the program, you will declare this value as a named constant. Similarly, to find the total inches, you need to multiply the feet by 12 and add the inches. Instead of using 12 directly in the program, you will also declare this value as a named constant. Using a named constant makes it easier to modify the program later.
To write the complete length conversion program, follow these steps:
1. Begin the program with comments for documentation. 2. Include header files, if any are used in the program. 3. Declare named constants, if any. 4. Write the definition of the function main. Check Answer. |
- Home
- C Programming
- _Algorithm & Flow Chart in C
- _Introduction to C
- _Control Statement & Looping
- _Function in C
- _Array in C
- _Pointer in C
- _Structure & Union in C
- _List of C Programs
- __Tricky Programs
- __Pattern in C
- _C Compiler
- _C Programming हिंदी में (Videos के साथ)
- C++ Programming
- _List of C++ Programs
- _C/C++ Questions
- _Minor Project 2021-22
- Projects
- App. Physics
- _Assignment 1 (2023-24)
- _Assignment 2 (2023-24)
- _Assignment 3 (2023-24)
- _AP Assignment 2
- _AP Assignment 3
- _Assignment No.2.1
- _Assignment No. 2.2
- _Office Automation & Tools
- _Introduce Yourself
- Online Exams
- _Online Attendance
- _Interview Questions
- _Youtube Channel
- More Tutorials
- _UPBTE Links
- _URISE
- _Internal Marks
- _Enrolment No
- _More Tutorials