Advertisement
JakubJaneczek

Zadanie 23

Apr 8th, 2020
173
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 a;
  5. int liczba_cyfr(int a){
  6.     int b=1;
  7.     while(a=a/10)b++;
  8.     return b;
  9. }
  10.  
  11. int main()
  12. {
  13.  
  14.     cout << "Podaj liczbe: " << endl;
  15.     cin >> a;
  16.     cout << "Ilosc cyfr  " << endl;
  17.     cout<< liczba_cyfr(a) << endl;
  18.     cout << "Ilosc cyfr w 22  " << endl;
  19.     cout<< liczba_cyfr(22) << endl;
  20.     cout << "Ilosc cyfr w 222 " << endl;
  21.     cout<< liczba_cyfr(222) << endl;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement