Ex.No. #3 EXPONENTIATION OF A NUMBER (Tamil)



Ex. No. : 03   EXPONENTIATION OF A NUMBER


Aim:

To write a Python program to find the exponentiation of a number.

Program:

b=int(input("Enter the base value :"))                   5
e=int(input("Enter the power :"))                           3

p=1
for i in range(e):        0,1,2   0          i=1                               i=2                               (start)
   p=p*b                       =1*5    5          p=5*5 = 25                 p=25*5=125              (start:stop)
print("The exponentiation value of the number", b, "is" , p)                             (start:stop:step)
                                                                                                                                    (0,12,2)=0,2,4,6,8,10
Output:
Enter the base value :5
Enter the power :3
The exponentiation value of the number 5 is 125

an = a power n         a is base,      n is exponent

53 = 5x5x5 = 125

1st        i=0       p=1*5             p=5
2nd       i=1       p=5*5             p=25
3rd       i=2       p=25*5           p=125

Comments

Popular posts from this blog