Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- std::vector<int> PotpuniKvadrati(int n)
- {
- std::vector<int> v;
- for(int i(0); i < n; i++)
- {
- if(sqrt(i) == int(sqrt(i)))
- v.push_back(i);
- }
- return v;
- }
- int main()
- {
- std::vector<int> test = PotpuniKvadrati(100);
- for(unsigned int i(0); i < test.size(); i++)
- std::cout << test[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement