Professional Documents
Culture Documents
Power in Mathematics - GeeksforGeeks
Power in Mathematics - GeeksforGeeks
Data Structures Algorithms Interview Preparation Topic-wise Practice C++ Java Python Competitive Programming Machine Learning Web Dev
Table of Contents
✕
C++ Data Types The power of a number says how many times to use the number in a
multiplication. Powers are also called Exponents or Indices. For
Set in C++ Standard Template example, 8^2 could be called “8 to the power 2” or “8 to the second
Library (STL)
power”, or simply “8 squared”.
Coin Change | DP-7
Sieve of Eratosthenes
Prime Numbers
Complete
1. If the indices is 1, then you just have the number itself. For example, Interview
5^1 = 5
Preparation
2. If the indices is 0, then you get 1. For example, 5^0 = 1 View Details
3. Exponents make it easier to write and use many multiplications
4. Negative exponent means how many times to divide one by the
number.For example, 5^-1 = 1 /5 = 0.2 System Design-
Live Classes for
How we check if a number is power of y for a given integer x ? Working
Naive solution: Professionals
Given two positive numbers x and y, check if y is a power of x or not. View Details
Examples :
/* Returns 1 if y is a power of x */
bool isPower(int x, long int y)
{
// The only power of 1 is 1 itself
if (x == 1)
return (y == 1);
M O ST V I S I T E D I N
Recent Articles on Power!
SCHOOL
PROGRAMMING
Attention reader! Don’t stop learning now. Get hold of all the
important mathematical concepts for competitive programming with Python Dictionary
the Essential Maths for CP Course at a student-friendly price. To
complete your preparation from learning a language to DS Algo and Arrays in C/C++
many more, please refer Complete Interview Preparation Course.
Reverse a string in Java
Previous Next
R ECO M M E N D E D A RT I C L E S Page : 1 2 3
02 Compute power of
power k times % m
28, Jun 18 06 Find power of power
under mod of a prime
22, Feb 17
Article Contributed By :
ABHISHEK TIWARI 13
@ABHISHEK TIWARI 13
Improved By : jana_sayantan
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Load Comments
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie
Got It !
Policy & Privacy Policy
@geeksforgeeks , Some rights reserved