一、数字反转游戏,输入任何一个数,请逆序输出。二、求七位自幂数(北斗七星数)。

img

img


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    int n;
    scanf("%d",&n);
    int re=0;
    
    while(n)
    {
        re = re*10+n%10;
        n/=10;
    }
    printf("%d",re);
    
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main()
{
    for(int k=1000000;k<=9999999;++k)
    {
        int sum=0;
        int temp=k;
        while(temp)
        {
            sum = sum + pow(temp%10,7);
            temp/=10;
        }
        
        if(sum==k)printf("%d ",k);
    }
    return 0;
}