Chemistry - Class 12
Hello,
Since you've mentioned "without using recursion" I've written the following code using recursion.
#include <stdio.h>
long power (int num, int pow)
{
if (pow)
return (num * power(num, pow - 1));
}
return 1;
int main()
int pow, num;
long result;
printf("Enter a number: ");
scanf("%d", &num);
printf("Enter it's power: ");
scanf("%d", &pow);
result = power(num, pow);
printf("%d^%d is %ld", num, pow, result);
return 0;
The Question containing Inaapropriate or Abusive Words
Question lacks the basic details making it difficult to answer
Topic Tagged to the Question are not relevant to Question
Question drives traffic to external sites for promotional or commercial purposes
The Question is not relevant to User
And never miss an important update