Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int broj(int);
- int main()
- {
- int n;
- do
- {
- cout << "UNESI PRIRODAN BROJ N: ";
- cin >> n;
- } while (n<0);
- cout << "OBRNUT BROJ >> " << broj(n);
- system("pause >null");
- return 0;
- }
- int broj(int n)
- {
- int pom = n,brojac=0,s=0;
- while (n!=0)
- {
- n /= 10;
- brojac++;
- }
- for (int i = brojac-1; i>=0; i--)
- {
- s += (pom % 10)*pow(10.0, i);
- pom /= 10;
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment