write a python program to find the square and square root of a number
Answers
Answered by
2
Answer:
this is how you can write a program in Python to find square of any number of your choice and user choice
Explanation:
a = input("Enter the first digit:")
b = input("Enter the second digit:")
a = int(a)
b = int(b)
square = (a * b)
print("the average of two numbers is" , square)
Answered by
1
The code in python to find the square and square root of a number is:
import math
print("Enter a number")
n = int(input())
squareOfn = n*n
squareRootOfn = math.sqrt(n)
print("Square of", n, ":", squareOfn)
print("Square Root of", n, ":", squareRootOfn)
- Firstly, we import the math library in python using the statement:
import math
- Then we take the number as input from the user in the variable n.
- We calculate the square of n and store it in the variable 'squareOfn'.
- We calculate the square root of n and store it in the variable 'squareRootOfn'.
- Lastly, we print the values stored in the variables squareOfn and squareRootOfn.
#SPJ3
Similar questions
Math,
4 months ago
Social Sciences,
4 months ago
Social Sciences,
11 months ago
Social Sciences,
11 months ago