Quick actions

cmd+k|ctrl+k

Navigation

Languages

求一个三位数,各位数的阶乘之和等于该数

Snippet info

Language

C

Visibility

public

Author

1546315460

Created

2020-07-20T23:34:47Z

Updated

2020-07-20T23:34:58Z

#include <stdio.h>

int f(int n); //get n!

int main(void) {
    int a=1, b=1, c=1;  //printf("Hello World!\n");
    if(f(a)+f(b)+f(c) == a*100 + b*10 + c)//for(a=1; )
    {
        return a*100 + b*10 + c;
    }
}

int f(int n) //get n!
{
    int t=1,i;
    for(i=1; i<=n; i++)
    {
        t=t*i;   
    }
    return t;
}
INFO