Write a program in C++ to find power of any number using for loop
- برمجة سي بلس بلس
- برمجة
- 2021-05-12
- MarwaMohammed
الأجوبة
#include <iostream>
using namespace std;
int main()
{
int bs, ex, num=1,i;
cout << "\n\n Find power of any number using for loop:\n";
cout << "---------------------------------------------\n";
cout << " Input the base: ";
cin >> bs;
cout << " Input the exponent: ";
cin>>ex;
for (i = 1; i <=ex; i++)
{
num=num*bs;
}
cout <<bs<<" ^ "<<ex<<" = "<<num<<endl ;
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
