Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- void digit (int num)
- {
- int num2 = num;
- int dc = 0;
- int x =0;
- int divisor = 0;
- {
- num=num/10;
- dc++;
- }
- divisor = pow(10, dc);
- while(dc < num)
- {
- num=num/10;
- dc++;
- }
- divisor = pow(10, dc);
- while(divisor > 0)
- {
- x = num2/divisor;
- cout << x << endl;
- x=x*divisor;
- x=num2-x;
- divisor=divisor/10;
- }
- }
- int main ()
- {
- int num = 0;
- cout << "Please enter a number: ";
- cin >> num;
- digit(num);
- cin.ignore();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement