Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int liczba_cyfr(int x)
- {
- int warunek_zer=10;
- int licznik_zer=1; //na pewno liczba bedzie miec przynajmniej 1 mniejsza od 10
- while(x>=warunek_zer)
- {
- warunek_zer*=10;
- licznik_zer++;
- }
- return licznik_zer;
- }
- int main()
- {
- int liczba=0;
- cout << "Podaj liczbe: "; cin>>liczba;
- cout << "Liczba cyfr to: "<<liczba_cyfr(liczba);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment