Josif_tepe

Untitled

Feb 9th, 2026
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.    
  9.     int broj_na_cifri = 0;
  10.    
  11.     if(n == 0) {
  12.         broj_na_cifri = 1;
  13.     }
  14.     while(n > 0) {
  15.         broj_na_cifri++;
  16.         n /= 10;
  17.     }
  18.    
  19.     cout << broj_na_cifri << endl;
  20.    
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment