请补充main函数,该函数的功能是:求1+21+3!+…+N!的和。例如, 1+2!+3!+...+5!+6!的和为873。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>main ( ){int i, n;long s=0, t=l;clrscr ();printf ("\nInput n: \n");scanf ("%d",【 】);for (i=l; i<=n; i++){t=【 】;s=【 】;}printf ("1 ! +2 ! +3 !... +%d! =%ld\n", n, s);}

请补充main函数,该函数的功能是:求1+21+3!+…+N!的和。

例如, 1+2!+3!+...+5!+6!的和为873。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

main ( )

{

int i, n;

long s=0, t=l;

clrscr ();

printf ("\nInput n: \n");

scanf ("%d",【 】);

for (i=l; i<=n; i++)

{

t=【 】;

s=【 】;

}

printf ("1 ! +2 ! +3 !... +%d! =%ld\n", n, s);

}


相关考题:

请补充main函数,该函数的功能是:从键盘输入一个长整数,如果这个数是负数,则取它的绝对值,并显示出来。例如,输入:-3847652,结果为:3847652。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>main(){long int n;clrscr();printf("Enter the data;\n");scanf(【 】);printf("*** the absolute value ***\n");if(n<0)【 】printf("\n\n");printf(【 】);}

请补充函数fun(),函数fun()的功能是求7的阶乘。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>long fun(int n){if(【 】)return(n*fun(【 】);else if(【 】)return 1;}main(){int k=7;printf("%d!=%ld\n", k, fun(k));}

请编写函数fun(),其功能是:计算并输出下列多项式的值。S=1+4/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+n)例如,着主函数从键盘给n输入50后,则输出为 S=1.960784。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio.h>double fun(int n){}main (){int n;double s;printf ("\nInput n: ");scanf ("%d", n);s=fun (n);printf ("\n\ns=%f\n\n", s);}

给定程序MODll.C中fun函数的功能是:求出以下分数序列的前n项之和。和值通过函数值返回main函数。例如,若n=5,则应输出:8.391667。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!

请教计算机二级c语言考试题 请补全main函数,该函数的功能是:求1+2!+3!+…+N!的和。1) main()2) {int i,n;3) long s=0,t=1;4) //clrscr();5) printf("\nInput n:\n");6) scanf("%d",___1___);7) for(i=1;i=n;i++)8) {9) t=___2___;10) s=___3___;11) }12) printf("1!+2!+3!...+%d!=%ld\n",n,s);13) }

请补充函数proc,函数proc的功能是求7的阶乘。 注意:部分源程序给出如下。 请勿改动main函数和其他函数中的任何内容,仅在函数proc的横线上填入所编写的若干表达式或语句。 试题程序: includestdio.h long proc(int n) { if( 【1】 ) return(n*proc( 【2】 ); else if(【3】) return l; } void main { int k=7: printf("%d!=%ld\n",k,proc(k)); }

请编写函数proc(),它的功能是计算: s=(1n(1)4-1n(2)+In(3)4-…+1n(m))0.5 在C语言中可调用log(n)函数求1n(n)。 例如,若n1的值为30,则proc()函数值为8.640500。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。 试题程序:

请补充fun()函数,fun()函数的功能是求n的阶乘。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在fun()函数的横线上填入所编写的若干表达式或语句。 试题程序:

请补充主函数main(),该函数的功能是:把从键盘输人的3个整数按从小到大输出。 例如,输入“506040”,结果输出“405060”。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在横线上填人所编写的若干表达式或语句。 试题程序: