geeksforgeeks
search icon
  • Courses
    Sale
  • Tutorials
  • Interview Prep
    Videos
    July 07, 2022 |910 Views

    Calculate power (x,y) using recursion

    Maths, recursion, divide-and-conquer, Divide and Conquer
     Save  Share   Like
    Description
    Discussion

    Given two integers x and n, write a function to compute xn. We may assume that x and n are small and overflow doesn’t happen.
    Input : x = 2, n = 3
    Output : 8

    Input : x = 7, n = 2
    Output : 49


    Calculate power (x,y) using recursion : https://www.geeksforgeeks.org/write-a-c-program-to-calculate-powxn/

    Recommendations
    Video Thumbnail
    08:31
    Video Thumbnail
    65.4K Views | 31/07/2024...
    Tower of Hanoi
    Video Thumbnail
    14:57
    Video Thumbnail
    13.8K Views | 04/07/2022...
    Find the missing element in the Arithmetic Progression
    Video Thumbnail
    09:13
    Video Thumbnail
    1.4K Views | 04/07/2022...
    Median of two sorted arrays of same size
    Video Thumbnail
    08:44
    Video Thumbnail
    97.0K Views | 28/06/2022...
    Closest Pair of Points
    Video Thumbnail
    04:37
    Video Thumbnail
    140.0K Views | 28/06/2022...
    Strassen’s Matrix Multiplication
    Video Thumbnail
    05:04
    Video Thumbnail
    10.2K Views | 13/06/2022...
    Power without using multiplication(*) and division(/) operators
    GeeksforGeeks
    location
    Corporate & Communications Address:
    A-143, 6th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
    location
    Registered Address:
    K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
    GFG App on Play StoreGFG App on App Store
    • Company
    • About Us
    • Legal
    • Privacy Policy
    • Contact Us
    • Advertise with us
    • GFG Corporate Solution
    • Campus Training Program
    • Explore
    • POTD
    • Job-A-Thon
    • Blogs
    • Nation Skill Up
    • Tutorials
    • Programming Languages
    • DSA
    • Web Technology
    • AI, ML & Data Science
    • DevOps
    • CS Core Subjects
    • Interview Preparation
    • Software and Tools
    • Courses
    • ML and Data Science
    • DSA and Placements
    • Web Development
    • Programming Languages
    • DevOps & Cloud
    • GATE
    • Trending Technologies
    • Videos
    • DSA
    • Python
    • Java
    • C++
    • Web Development
    • Data Science
    • CS Subjects
    • Preparation Corner
    • Interview Corner
    • Aptitude
    • Puzzles
    • GfG 160
    • System Design
    @GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved