Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int LICZBA_CYFR(int a);
- int main(){
- cout << LICZBA_CYFR(10)<<endl;
- cout << LICZBA_CYFR(101)<<endl;
- cout << LICZBA_CYFR(10123241)<<endl;
- cout << LICZBA_CYFR(0)<<endl;
- cout << LICZBA_CYFR(1)<<endl;
- }
- int LICZBA_CYFR(int a){
- if (a == 0) return 1;
- int i = 0;
- while (a >= pow(10, i)) i++;
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment