Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int n, x=0;
- cout << "Podaj liczbe:";
- cin >> n;
- while (n!=0)
- {
- if (n%2==0)
- {
- int y=sqrt(n); // pierwiastek licze z podanego "n"
- if (y%2==0) x++; // jesli podziele ten pierwiastek przez 2 to ma nie byc reszty, bo to ma byc kwadrat, wiec nie moze reszty dac
- }
- cout << "Podaj liczbe:";
- cin >> n;
- }
- cout << "Kwadratow liczb parzystych bylo: " << x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement