forked from SHabaj-dev/Hactoberfest-2022
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Program To Create Perfect Square
- Loading branch information
1 parent
369ce08
commit 5bfe413
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); | ||
|
||
// variable declaration | ||
int i, number; | ||
|
||
// take user input | ||
printf("Enter a number: "); | ||
scanf("%d", &number); | ||
|
||
// loop to check number is perfect square or not | ||
for(i = 0; i <= number; i++) | ||
{ | ||
if(number == i*i) | ||
{ | ||
printf("\n\n\n\t\t\t%d is a perfect square\n\n\n", number); | ||
|
||
printf("\n\n\t\t\tCoding is Fun !\n\n\n"); | ||
return 0; // same as using break in this case to end the program | ||
} | ||
} | ||
printf("\n\n\n\t\t\t%d is not a perfect square\n", number); | ||
printf("\n\n\t\t\tCoding is Fun !\n\n\n"); | ||
return 0; | ||
} |