how to do it?

Hii
can anyone explain to me how to do it?


write a program that prompts the user to enter the length of an object in centimeters and finds and prints the length in centimeters ,meters ,and kilometers.

sample input/ output:

Enter the length in centimeters: 2346754
2346754 centimeters has 23 kilometers, 467 meters, and 54 centimeters
You need to read and show values. See http://www.cplusplus.com/doc/tutorial/basic_io/

Look at operators / and % from http://www.cplusplus.com/doc/tutorial/operators/
can u show me the answer please
i really didnt understand how to do it
Hint: What is 12345 % 1000 ?
Try making a program and writing
std::cout << (12345 % 1000) << std::endl;
Then, what is
std::cout << (12345 / 1000) << std::endl;

Try it with 100 or 10 instead of 1000. You'll start to see a pattern.
Optionally, save a calculation into a variable using
int a = 2346754 % 100;
Last edited on
Topic archived. No new replies allowed.