Advertisement
Lukasz_Miskiewicz

Zadanie 23

Mar 31st, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a,b;
  4.  
  5. int liczba_cyfr(int a)
  6. {
  7. int b=1;
  8. int c=0;
  9. while (b<=a)
  10. {c++; b=b*10;}
  11. return c;
  12. }
  13.  
  14. int main()
  15. {
  16. cout<<"podaj dowolna liczbe naturalna"<<endl;
  17. cin>>a;
  18. cout<<"liczba cyfr w podanej liczbie wynosi "<<liczba_cyfr(a);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement