Search
 
SCRIPT & CODE EXAMPLE
 

CPP

powers of 2 in cpp

// If not using any extra libraries
// Powers of 2. If finding 2^n
int main() {
  int ans = 1 >> n;
}
// Suppose we want to find x ^ y
void power(int x, int y) {
  int ans = 1;
  for (int i = 0; i < y; i++) {
    ans *= x;
  }
  return ans;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ max function 
Cpp :: min stack 
Cpp :: how to implement stack 
Cpp :: double pointers C++ 
Cpp :: while loop in c++ 
Cpp :: c++ if else if 
Cpp :: how to convert n space separated integers in c++ 
Cpp :: int to string Using to_string method 
Cpp :: function template in c++ 
Cpp :: Default code in C++ for VSCode 
Cpp :: c++ new operator 
Cpp :: Arduino Counting 
Cpp :: c++ handling 
Cpp :: a function to create double quotes for alphabet in c++ 
Cpp :: tan ^-1 ti 83 
C :: how to create random integers from a specific range in c language 
C :: arduino wifi ip address to string 
C :: c get time 
C :: get window width height glfw 
C :: restart nginx in alpine linix 
C :: reverse integer in c 
C :: find the largest number among five numbers in c language 
C :: block a website on mac 
C :: bootstrap 5 image responsive 
C :: redirect to url page asp.net mvc 
C :: c syntax 
C :: go Iterating over an array using a range operator 
C :: addition.c 
C :: replacing a character in string in C 
C :: how to convert int in to const char in c 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =