Power of a number program in CPlusPlus (C++, CPP) and C with the flowchart
In this tutorial, we will learn about the followings;
- Flowchart of a program of the power of a number
- Power of a number program in CPlusPlus (C++, CPP)
- Power of a number program in C
Flowchart of a program of the power of a number
Coming Soon.
Power of a number program in CPlusPlus (C++, CPP)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include <iostream> #include <conio.h> using namespace std; int main() { int base; int power; int x,result=1; cout<<"Enter base: "; cin>>base; cout<<"Enter power: "; cin>>power; for(x=power;x>0;x--) { result=result*base; } cout<<"Result of power is: "<<result; getch(); } |
Output

Power of a number program in C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <stdio.h> int main() { int base; int power; int x,result=1; printf("Enter base: "); scanf("%d", &base); printf("Enter power: "); scanf("%d", &power); for(x=power;x>0;x--) { result= result*base; } printf("Result of Power is: %d", result); return 0; } |
Output
Figure: Power of a number program in CPlusPlus (C++, CPP) and C with the flowchart.