# CREATE OWN LIBRARY

## Exponential without function

Back to Programming

### Description

The program is written to find the exponent of a number without using the inbuilt function. The number and the exponent are taken as input. The numbers are multiplied exponential time to get the value.

For example, the given number is 2 and the exponent is 5, therefore, 2 will be multiplied 5 times.

The value will be: 2×2×2×2×2 = 32

### Algorithm

INPUT: The number and the exponent

OUTPUT: The exponential value of the number

PROCESS:

Step 1: [Taking the input]

Step 2: [Finding the exponential]

Set e<-1

[Finding the exponential]

While exp!=0 repeat

Set e<-e×n

Set exp<-exp-1

[End of ‘while’ loop]

[Displaying the value]

Print "The result is: e"

Step 3: Stop.

## TIME COMPLEXITY:

while(exp!=0)----------------------------------O(m)

{

e=e*n;

exp--;

}

The time complexity of this program is O(m) where ‘m’ is the exponent.

## SPACE COMPLEXITY:

The space complexity of this program is O(1) as it requires a constant number of memory spaces for any given input.