0

i need answer for this Q is that how we can write program in C++ to eccept any number and print it with its digit? and thanx^^

5
Contributors
7
Replies
23
Views
3 Years
Discussion Span
Last Post by Ancient Dragon
0

You'll need to better define the problem.

Do you mean to take in words that define a number, like "two thousand forty five" and convert to digits, 2045?
Or to take in a numeric value, like 2045 and display as separate digits, 2 0 4 5?

Once you have the problem figured out, write some code to solve it. If you have problems, post your code here and ask questions.

0

I mean like
int x;
cin>>x;
cout<<x<<the digit;
i need the code that except the number and print it and next its digit

0

I have a test tomorrow and I want to answer it on one of my question please

0

I have a test tomorrow and I want to answer it on one of my question please

0

What is your definition of a digit? A number is a digit or is made of digits so I'm not sure what you are talking about.

0

x % 10 will return the right most digit, for example if x = 15 then x%10 will return 5. Now put that in a loop, divide x by 10, to get all the digits

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.