Advertisement
DMG

Inverzni broj

DMG
Mar 8th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. main()
  5. {
  6.       int n, s, i, m;
  7.       cin >> n;
  8.       i=0;
  9.       m=n;
  10.       do
  11.       {
  12.           m = m/10;
  13.           i=i+1;
  14.       }
  15.       while (m > 0);
  16.       s=0;
  17.       do
  18.       {
  19.             s = s + (n%10) * pow(10.0,i-1);
  20.             n = n / 10;
  21.             i = i - 1;
  22.       }
  23.       while (i>0);
  24.       cout << s;
  25.       system("PAUSE");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement