- Full Information About Artificial Intelligence | What is AI?
- Most Common Important 70+ Shortcut Keyboard Keys
- Stars Square Pattern
- Fascinating Number or Not in C and CPP
- Implement queue using linked list c program
- Calculate the GCD | Euclidean algorithm | c and cpp programming language
- Linear search in c | Algorithm of Linear search | c programming
- A C program for checking whether a given line is a comment
- C program to convert decimal to binary without array
- Voting program in C language using switch case
- C program to check eligible for vote
- Insertion and deletion in double linked list in c program
- File read in C | File Handling | How to read File
- C program to replace vowels with special characters
- Call by Reference in C programming language
- Function call by value in c programming language
- Program to print a message without using semicolon in c programming
- User login system in c programming language
- How to make swastik in c and cpp programming language
- Print numbers from 1 to 100 using while loop c and cpp program
- Simple Macro Substitution(#define) in c and cpp programming language
- Insertion and Deletion of all operation at singly Linked list in c programming langauge
- Write a program to count the digit in a number
- Program to calculate the power of given numbers by user in c and cpp
- Sum of digit calculate program
- Write a program to reverse a number
- Floyd Triangle | Programs | Algorithm
- Program to check whether number is Disarium Number
- Sunny Number in programming
- Happy Number | with Example and Programs
- Display Name of the month by accepting digit of the month | c programming
- Spy Number | c programming
- 9 basic program in cpp programming language
- Automorphic number | c programming language
- C programming restaurant menu code lapmos
- Neon Number c programming language
- Strong Number in C programming What is Strong Number
- Leap Year | Leap year program in c
- Pascal Triangle C programming
- Check Palindrome Number in c
- Print Fibonacci Series in c
- Swap two number without using third variable c programming langauge
- Swap two number c programming
- Largest Number c programming language
- Prime number program in c
- What is the mean by Software Engineering?
- Creating an Instagram Login Page Clone with HTML, CSS, and JS: Step-by-Step Guide

In this program, we will take two inputs from the users, one will be the **base** and another one is **exponent**.

For Example : 3^{2 }

3 is the base number.

2 is the exponent.

power is equal to 3 * 3.

```
#include<stdio.h>
int main(){
int base, exp, pow = 1;
printf("Enter the base number : ");
scanf("%d", &base);
printf("Enter the exponent : ");
scanf("%d", &exp);
for(int i = 1; i <= exp; i++){
pow = pow * base;
}
printf("%d ^ %d is : %d", base, exp, pow);
return 0;
}
```

```
#include<iostream>
using namespace std;
int main(){
int base, exp, pow = 1;
cout<<"Enter the base number : ";
cin>>base;
cout<<"Enter the exponent : ";
cin>>exp;
for(int i = 1; i<=exp; i++){
pow = pow * base;
}
cout<<base<<"^"<<exp<<" = "<<pow;
return 0;
}
```

- START
- READ base and exp
- SET POW = 1
- START for loop, when condition (i ≤ exp) is true then go to STEP 5.
- Calculate pow = pow * base.
- Every iteration increment i by 1.
- PRINT pow
- EXIT

Initial i = 1, i ≤ 3 condition true then.

pow = 1 * 2 = 2.

pow = 2.

After this increment iteration i by 1.

Now i = 2

pow = 2 * 2 = 4

After this increment iteration i by 1.

Now i = 3.

pow 4 * 2 = 8

After this increment iteration i by 1.

Now i = 4.

Loop is terminated because the condition is false.

```
#include<stdio.h>
#include<math.h>
int main(){
int base, exp;
printf("Enter the base number : ");
scanf("%d", &base);
printf("Enter the exponent : ");
scanf("%d", &exp);
int power = pow(base, exp);
printf("%d", power);
return 0;
}
```

```
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int base, exp;
cout<<"Enter the base number : ";
cin>>base;
cout<<"Enter the exponent : ";
cin>>exp;
int power = pow(base, exp);
cout<<power;
return 0;
}
```

🖤 0

Buy me coffee ☕

## Comments

Oops!