Advertisement
Michal_Pilarski

zad23

Mar 22nd, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int liczba,b=1;
  5. int liczba_cyfr(int liczba)
  6. {
  7.     while(liczba=liczba/10)
  8.     {
  9.         b++;
  10.     }
  11.     return b;
  12. }
  13.  
  14. int main()
  15. {
  16.     cout << "Podaj liczbe: ";
  17.     cin >> liczba;
  18.     if(liczba<0)
  19.     {
  20.         cout<<"Podaj liczbe naturalna nastepnym razem :)"<<endl;
  21.         return 0;
  22.     }
  23.     cout<<"Ta liczba posiada: "<<liczba_cyfr(liczba)<<" cyfr";
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement