If ceil and floor are equal the number is a perfect square
if ( ceil ( ( double ) sqrt ( n ) ) == floor ( ( double ) sqrt ( n ) ) ) { cout << " perfect ▁ square " ; } else { cout << " not ▁ a ▁ perfect ▁ square " ; } }