#codeifyoucansolve
The 5−digit number, 16807=7^5, is also a fifth power. Similarly, the 9-digit number, 134217728=8^9, is a ninth power.
Given N, print the N−digit positive integers which are also an Nth power?
#include <stdio.h>
#include <math.h>
int main(void) {
unsigned long long int lb,ub,i,tmp;
int n;
scanf("%d",&n);
if(n>0&&n<=19)
{
lb=pow(10,(n-1));
ub=pow(10,n);
i=1LL;
while(1)
{
tmp=(long long int)pow(i,n);
if((n==19||n==18||n==17)&&tmp>=lb)
{
printf("%llu\n",tmp);
break;
}
if(tmp>=lb&&tmp<ub)
{
printf("%llu\n",tmp);
}
if(tmp>=ub)
break;
i++;
}
}
return 0;
}