If ceil and floor are equal the number is a perfect square
if ( Math . Ceiling ( ( double ) Math . Sqrt ( n ) ) == Math . Floor ( ( double ) Math . Sqrt ( n ) ) ) { Console . Write ( " perfect ▁ square " ) ; } else { Console . Write ( " not ▁ a ▁ perfect ▁ square " ) ; } }