1234567891011121314151617 |
- pub fn is_perfect_square(num: i32) -> bool {
- for x in 1..46341 {
- let res = (x as i32).pow(2);
- if res > num {
- return false;
- }
- if res == num {
- return true;
- }
- }
- return false;
- }
-
- fn main() {
- println!("Expected: true");
- println!("Got: {}", is_perfect_square(16));
- }
|