Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int fact(int x)
- {
- int br = 0;
- if (x < 10 && x>0)
- {
- return 1;
- }
- else
- {
- while(x>0)
- {
- x / 10;
- br++;
- x = x / 10;
- }
- return br;
- }
- }
- int main()
- {
- int x;
- cout << "Enter a num: ";
- cin >> x;
- cout << "Your number cosist of: " << fact(x) << " digits.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement