In this article, I would like to share with you guys a simple program that will ask the user to give base and power value of a number and then our program will compute the power value of the number using C++ as our programming language.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com.
Sample Program Output
Program Listing
// power_number.cpp
// Author : Jake Rodriguez Pomperada,MAED-IT
// Date : October 8, 2019 Tuesday 8:32 PM
// Website : http://www.jakerpomperada.com
#include <iostream>
using namespace std;
int main() {
int num=0,a=1,pw=0;
cout <<"\n\n";
cout <<"\tPower of a Number in C++";
cout <<"\n\n";
cout << "\tEnter the Base Value : ";
cin >> num;
cout << "\tEnter the Power Value : ";
cin >> pw;
cout <<"\n";
for (int i=1; i<=pw; i++) {
a=a*num;
}
cout <<"\tThe result is " <<a <<".";
cout <<"\n\n";
cout <<"\tEnd of the Program";
}
No comments:
Post a Comment