编辑代码

#include <stdio.h>
int main () {
    float power (float a)
    {
        float x = 1 ;
        while (a>0){
            x=x*a ;
            a=a-1 ;
        }
        return x ;
    }
    float power2 (float b)
    {
        float y = 0 ;
        while (b>0){
            y=y+power(b) ;
            b=b-1 ;
        }
        return y ;
    }
    float c ;
    scanf ("%f" , &c );
    while (c>0){
        printf ("%f的阶乘是%f\n", c , power(c));
        printf ("%f的阶乘加和%f\n", c , power2(c));
        c=c-1;
    }
    return 0 ;
}