Power


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 12M

Author:
Problem type

Write the program which takes two numbers a and b and returns the value of ab. For example for a = 3 and b = 4 the result is 34 = 81.


Comments


  • 0
    rajathilagamb  commented on March 16, 2023, 11:18 a.m.

    int atob(int a, int b) { int i, result = 1; for(i=0; i < b; i++) { result *= a; } return result; }

    int main() { int a,b; printf("Give a: "); scanf("%d", &a); printf("Give b: "); scanf("%d", &b); printf("a to the power of b = %d", atob(a,b)); return 0; }