Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a script to find the value of one number raised to the power of another

Posted By: Lurleen Fischer     Category: Unix / Linux / Ubuntu     Views: 7305

Write a script to find the value of one number raised to the power of another.

Code for Write a script to find the value of one number raised to the power of another in Unix / Linux / Ubuntu

echo "Input number"
read no
echo "Input power"
read power

counter=0
ans=1

while [ $power -ne $counter ]
do
        ans=`expr $ans \* $no`
        counter=`expr $counter + 1`
done

echo "$no power of $power is $ans"
  
Share: 



Lurleen Fischer
Lurleen Fischer author of Write a script to find the value of one number raised to the power of another is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!