Search
 
SCRIPT & CODE EXAMPLE
 

CPP

pow without math.h

int pow(int base, int exp)
    {
      if(exp < 0)
        return -1;

        int result = 1;
        while (exp)
        {
            if (exp & 1)
                result *= base;
            exp >>= 1;
            base *= base;
        }

        return result;
    }
Comment

PREVIOUS NEXT
Code Example
Cpp :: C++ program to print all possible substrings of a given string 
Cpp :: remove whitespace in cpp 
Cpp :: swap alternate elements in an array c++ problem 
Cpp :: how to run cpp using gcc vscode 
Cpp :: cast cpp 
Cpp :: what is the time complexitry of std::sort 
Cpp :: DSA 2. Complexity Analysis Google drive Educative excellent courses!!!! [Educative.io] Competitive Programming in C++ The Keys to Success 
Cpp :: select elements from array C++ 
Cpp :: Maximum sum of non consecutive elements 
Cpp :: create vector of specific size c++ 
Cpp :: if in c++ 
Cpp :: how to rotate a matrix 90 degrees clockwise 
Cpp :: ? in cpp 
Cpp :: max circular subarray sum gfg practice 
Cpp :: cpp foreach 
Cpp :: kmp c++ 
Cpp :: problem category codechef solution in c++ 
Cpp :: c++ method name 
Cpp :: c++ how to do a pointer char to take varols from keyboard 
Cpp :: Madiar loh 
Cpp :: simple program for sign in and sign up in c++ 
Cpp :: Minimizing the dot product codechef in c++ 
Cpp :: How to remove the % in zsh that show after running c++ file 
Cpp :: increment integer 
Cpp :: open url from dev cpp 
Cpp :: C++ Join thread 
Cpp :: CPPDEVELOPER 
Cpp :: file transfer socat 
Cpp :: convert char to string c++ 
Cpp :: error c4001 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =