Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Program ispisuje sve trocifrene brojeve koji imaju svojstvo: ABC=(AB)^2-C^2. Na primjer, 147=14^2-7^2. */
- #include <iostream>
- using namespace std;
- bool provjera(int broj)
- {
- return broj == pow(broj / 10, 2) - pow(broj % 10, 2);
- }
- void main()
- {
- cout << "Trocifreni brojevi koji imaju svojstvo: ABC=(AB)^2-C^2: " << endl;
- for (int i = 100; i <= 999; i++)
- if (provjera(i))
- cout << i << endl;
- system("pause>0");
- }
Advertisement
Add Comment
Please, Sign In to add comment