diff options
Diffstat (limited to 'C++/LengthInFeetPlusInchesRemainder')
-rw-r--r-- | C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp b/C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp new file mode 100644 index 0000000..bc95a35 --- /dev/null +++ b/C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp @@ -0,0 +1,19 @@ +// Given length in inches, this program outputs the equivalent +// length in feet and remaining inch(es). +#include <iostream> +using namespace std; +int main() { +int inches; //variable to store total inches + +cout << "Enter inches and press Enter: "; +cin >> inches; +cout << endl; + +cout << inches << " inch(es) = "; //output the value of +//inches and the equal sign +cout << inches / 12 << " feet (foot) and "; //output maximum +//number of feet (foot) +cout << inches % 12 << " inch(es)" << endl; //output +//remaining inches +return 0; +} |