## C Program To Check Perfect Square Number

Learn How To Check Perfect Square Number in C Programming Language. This C Program finds if an entered if a Number is a Perfect Square or not with and without using Functions.

#### What is a Perfect Square Number?

A Perfect Square is also known as **Simply Square Number**. A Perfect Square is a Number that can be expressed as the **Product of Two Equal Integers**. **4** is a Perfect Square Integer since it is the product of **2 * 2**.

#### Example

**1, 4, 16, 25, 36**

**Must Read: C Program To Check if a Number is a Prime Number or Not**

#### C Program To Check Perfect Square Number without Function

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<stdio.h> int main() { int num, temp, count = 1; printf("\nEnter the Number:\t"); scanf("%d", &num); temp = num; while(temp > 0) { temp = temp - count; count = count + 2; } if(temp == 0) { printf("\n%d is a Perfect Square\n", num); } else { printf("\n%d is Not a Perfect Square\n", num); } return 0; } |

#### C Program To Find Perfect Square Integer using Function

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include<stdio.h> int perfect_square_check(int temp) { int count = 1; while(temp > 0) { temp = temp - count; count = count + 2; } if(temp == 0) { return 1; } return 0; } int main() { int num, result; printf("\nEnter the Number:\t"); scanf("%d", &num); result = perfect_square_check(num); if(result == 1) { printf("\n%d is a Perfect Square\n", num); } else { printf("\n%d is Not a Perfect Square\n", num); } return 0; } |

**Must Read: C Program To Raise A Number to a Positive Power**

#### Output

If you have any compilation errors or doubts in this C Program To Check if a Number is Perfect Square or Not, let us know about in the Comment Section below.

Can we use For loop in the above C Program to check if a number is a perfect number or not?