Day 37: Power of a Number without in-built function of 100DaysCodingChallenge

Hello all, 

I have started the 100 days of coding challenge to improve my programming skills..

Today is the Day37 of 100DaysCodingChallenge for 

Power of a Number without in-built function  input Numbers taken by the user.

Code : 

let a = prompt("Enter a base : ");
let b = prompt("Enter b exponent : ");
function pow(n, e) {
  let num = n;
  for (let i = 1; i < e; i++) {
    num *= n;
  }
  return num;
}
console.log("The Power of", a+"'s", b, "Without In Built \nFunction is :", pow(a, b));

Output :     

 







Happy Coding:)

Comments

Popular posts from this blog

Day 100: Date Time to Number of 100DaysCodingChallenge

Day 64: Pattern using loops of 100DaysCodingChallenge

Day 20: Positive Number of 100DaysCodingChallenge