Power Calculator of Any Number in C language

PHOTO EMBED

Tue Apr 11 2023 16:27:27 GMT+0000 (Coordinated Universal Time)

Saved by @UpgraderBoy #c

#include<stdio.h>
#include<conio.h>

int main(){
    int power(int ,int);
    int result;
    int a,b;
    printf("Plz., enter a number: ");
    scanf("%d",&a);

    printf("Plz., enter power of the number: ");
    scanf("%d",&b);

    result = power(a,b);
    printf("%d to the power of %d is: %d",a,b,result);
}

int power(int a,int b)
{
    int i,j,result;
    result = a;
    for ( i = 1; i <= b; i++){
        if(i != 1)
        {
            a = result*a;
        }
    }
    return(a);
}
content_copyCOPY