C++ Program to Find Power of a Number using for loop:
Program:
1)#include<iostream>
2)using namespace std;
3)int main()
4){
5)int b,e;
6)int answer=1;
7)cout<<"enter base";
8)cin>>b;
9)cout<<"enter exponent";
10)cin>>e;
11)for(int i=1;i<=e;i++)
12)answer=answer*b;
13)cout<<"power of number"<<answer;
14)return 0;
15)}
DESCRIPTION:
How to find power of a number in c++ using for loop?In this program we find C++ Program to Find Power of a Number using for loop.This is a program to find power of a number using loop
in c++.To find the power of number in c++ is very easy.
0 Comments