Computer Science, asked by ishubagri, 9 months ago

write a program in python to read a number n and print n²,n³,n4...... plz answer.... and in last it's n of power 4 ​

Answers

Answered by rakeshchennupati143
114

Program:

num = int(input("ENter a number : "))

print("",num,"^2 = ",(num*num),"\n",num,"^3 = ",(num*num*num),"\n",num,"^4 = ",(num*num*num*num),sep='')

Output:

ENter a number : 10

10^2 = 100

10^3 = 1000

10^4 = 10000

Explanation:

  • First i took number into variable num using int(input()) methods, the int() method is used for taking only integer value in python.
  • input() is used to take input from the used it takes a string as argument and that string will be displayed on the output screen when the used is giving the input
  • after taking input i directly printer the square of the given number and cube of the number and 4rth power of the given number
  • in print() method takes String as argument or a variable as argument, so in string argument i said num² and calculated num² before printing
  • like that i have done for num³ and num⁴

---Hope you liked my program in python,if you liked it mark as brainliest, it would really help me.   :)


ishubagri: thanks...... nice explanation....
rakeshchennupati143: mark brainliest if you liked my answer :)
ishubagri: yupsss.... :)
rakeshchennupati143: do u want answers for all of your questions?
ashwin456ojha: why u didnt use math module? the statements would be short. btw nice explaination!!!
Answered by LUCKYM3210
44

Answer:

Using python

Explanation:

n=int(input("enter the number:"))

print (n**2,n**3,n**4)

Similar questions