limun11

62=6^3=36

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