65. C Program To find n Power n Given Number.
How does this program work?
- This Program is used to find n power of n number.
- Where the n is the given number
Here is the code
#include <stdio.h>
int main(void)
{
//Programme to find power of a number
int i=1, n, ans=1;
printf("Enter a number \n");
scanf("%d ", &n);
while (i<=n)
{
ans = ans*n; //power of number formula
i = i+1;
}
printf("%d to the power %d is %d", n, n, ans);
return 0;
}