Check if given number is perfect square | C # program for the above approach ; If ceil and floor are equal the number is a perfect square ; Driver Code
using System ; class GFG { static void checkperfectsquare ( int n ) { if ( Math . Ceiling ( ( double ) Math . Sqrt ( n ) ) == Math . Floor ( ( double ) Math . Sqrt ( n ) ) ) { Console . Write ( " perfect ▁ square " ) ; } else { Console . Write ( " not ▁ a ▁ perfect ▁ square " ) ; } } public static void Main ( ) { int n = 49 ; checkperfectsquare ( n ) ; } }