Write you own Power without using multiplication(*) and division(/) operators in C Program

Power function is calculated using the times multiple i.e. 5n is 5*5*5… n times. For this function, to work properly without using multiplication(*) and division(/) operators we will use nested loops that add the numbers n number of time.

Example

#include 
using namespace std;
int main() {
   int a= 4 , b = 2;
   if (b == 0)
      cout

Output

The answer is 16
Updated on: 2019-08-08T07:44:49+05:30

534 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements