Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int izbaci_nule(int broj)
- {
- int desetica(1), rezultat(0), mojbroj(broj);
- while(mojbroj > 0)
- {
- int cifra(mojbroj % 10);
- mojbroj/=10;
- if(cifra == 0) continue;
- rezultat+=cifra*desetica;
- desetica*=10;
- }
- return rezultat;
- }
- int main()
- {
- int n;
- std::cout << "Unesite neki broj: " << std::endl;
- std::cin >> n;
- std::cout << "Modifikovan broj: " << izbaci_nule(n) << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment