write an algorithm for accept a number and display it's square
Answers
Answered by
5
Answer:
An algorithm is a step-by-step procedure to solve any kind of problems.
Algorithm to accept a number and display its square :-
STEP 1: START.
STEP 2: Accept a number from the user, say N.
STEP 3: Multiply N with itself and store the result in variable S.
STEP 4: Display the value of S.
STEP 5: STOP.
Sample program for the question in Python.
n=int(input("Enter a number: "))
print(f"Square of {n} is {n*n}")
Sample I/O:
Enter a number: 5
Square of 5 is 25.
•••♪
Similar questions