limun11

Untitled

Jan 20th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int broj = 1, pohrana, temp, kvadrat;
  7.  
  8.     while (broj < 150) // (62<150)
  9.     {
  10.         pohrana = broj % 10; // pohrana=62%10; pohrana=2
  11.         broj++; // broj raste na 63 ---> BELAJ
  12.         if (pohrana == 2) // (pohrana==2) true, ulazimo u petlju
  13.         {
  14.             temp = broj / 10; // temp=63/10; temp=6
  15.             kvadrat = temp*temp; // kvadrat=36*36, što nam nikako ne treba--> kvadrat=temp*temp; kvadrat=6*6=36
  16.             if (kvadrat == broj) //36->63
  17.             {
  18.                 cout << broj << endl;
  19.             }
  20.         }
  21.     }
  22.  
  23.         system("PAUSE");
  24.         return 0;
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment