Skip to content

Commit

Permalink
Create Program To Create Perfect Square
Browse files Browse the repository at this point in the history
  • Loading branch information
sijanregmi authored Oct 2, 2022
1 parent 369ce08 commit 5bfe413
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions C/Program To Create Perfect Square
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;
}

0 comments on commit 5bfe413

Please sign in to comment.