Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

program to tell if a number is a perfect square

import math

# Taking the input from user
number = int(input("Enter the Number"))

root = math.sqrt(number)
if int(root + 0.5) ** 2 == number:
    print(number, "is a perfect square")
else:
    print(number, "is not a perfect square")
Comment

how to find if number is perfect square

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
  int n;
  double root;
  cout << "Enter The number : ";
  cin>>n;
  root = sqrt(n);
  if (pow(root + 0.5,2) == n) 
  {
    cout << "Perfect Square" << endl;
  }
  else
  {
   cout << "Not Perfect" << endl;
  }
  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Python :: order dictionary by value python 
Python :: strip unicode characters from strings python 
Python :: add element to list python at index 
Python :: Example XlsxWriter in Python 
Python :: python get dict values as list 
Python :: read pdf py 
Python :: How to set font size of Entry in Tkinter 
Python :: how to make a latency command discord.py 
Python :: python tkinter frame title 
Python :: python flask mail 
Python :: convert list into integer python 
Python :: get a list of ids from queryset django 
Python :: drop nulll python 
Python :: python __gt__ 
Python :: how to copy text file items to another text file python 
Python :: drop duplicate rows pandas except nan 
Python :: python execute time 
Python :: python selenium clear input 
Python :: import subdirectory python 
Python :: removing features pandas 
Python :: how to append data to csv file in python without replacing the already present text 
Python :: how to keep a webdriver tab open 
Python :: How to install XGBoost package in python using conda 
Python :: python async await 
Python :: how to make a python app for android 
Python :: python get number of days 
Python :: find how many of each columns value pd 
Python :: start virtualenv 
Python :: pandas remove column 
Python :: python print for loop one line 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =