题目内容 (请给出正确答案)
[主观题]

请补充函数fun(),该函数的功能是计算下面公式SN的值: 例如:当N=50时,SN=71.433699。 注意:部分源

请补充函数fun(),该函数的功能是计算下面公式SN的值:

请补充函数fun(),该函数的功能是计算下面公式SN的值: 例如:当N=50时,SN=71.4336

例如:当N=50时,SN=71.433699。

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

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

试题程序:

include<conio.h>

include<stdio.h>

double fun(int n)

{

double s=1.0,S1=0.0;

int k;

for(【l】;k<=n;k++)

{

s1=s;

【 】;

}

return【 】;

}

main()

{

int k=0;

double S;

clrscr();

printf("\nPlease input N=");

scanf("%d",&k);

s=fun(k);

printf("\ns=%lf",s);

}

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“请补充函数fun(),该函数的功能是计算下面公式SN的值: …”相关的问题

第1题

请补充函数fun(),该函数的功能是:计算N×N维矩阵元素的方差,结果由函数返回。维数N在主函数中输入。

请补充函数fun(),该函数的功能是:计算N×N维矩阵元素的方差,结果由函数返回。维数N在主函数中输入。例如:

请补充函数fun(),该函数的功能是:计算N×N维矩阵元素的方差,结果由函数返回。维数N在主函数中输

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

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

试题程序:

include <stdio.h>

include <conio.h>

include <stdlib.h>

include <math.h>

define N 20

double fun(【 】,int n)

{

int i,j;

int k;

double s=0.0;

double f=0.0;

double aver=0.0;

double sd=0.0;

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

for(j=0;j<n;j++)

s+=a[i][j];

aver=【 】;

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

for(j=0;i<n;j++)

f+=(a[i][j]-aver)*(a[i][j]-aver);

f/(n*n);

sd=【 】;

return sd;

}

main()

{

int a[N][N];

int n;

int i,j;

double s;

clrscr();

printf("***+Input the dimension of

array N*****\n");

scanf("%d",&n);

printf("***** The array *****\n");

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

{

for(j=0;j<n;j++)

{

a[i][j]=rand()%50;

while(a[i][j]=0)

a[i][j]=rand()%60;

printf("%4d",a[i][j]);

}

printf("\n\n");

}

s=fun(a,n);

printf("******* THE RESULT *******\n");

printf("%4.3f\n",s);

}

点击查看答案

第2题

请补充fun函数,该函数的功能是:判断一个年份是否为闰年。 例如,1900年不是闰年,2004是闰年。 [注意

请补充fun函数,该函数的功能是:判断一个年份是否为闰年。

例如,1900年不是闰年,2004是闰年。

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

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

[试题源程序]

include<stdio.h>

include<conio.h>

int fun(int n)

{

int fiag=0;

if(n%4==0)

{

if((1) )

fiag=1;

}

if((2) )flag=1;

return (3) ;

}

void main()

{

int year;

clrscr();

printf("Input the year:");

scanf("%d", &year);

if(fun(year))

printf("%d is a leap year.\n", year);

else

printf("%d is not a leap year.\n", year);

}

点击查看答案

第3题

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存在字符串str中,字符串str从键盘输人,其长度作为参数传人fun()函数。

例如,输入“abcdef”,则输出“bdf”。

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

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

试题程序:

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍

点击查看答案

第4题

请补充函数fun(),该函数的功能是:判断某一个年份是否为闰年。 例如,1900年不是闰年,2004是闰年。

请补充函数fun(),该函数的功能是:判断某一个年份是否为闰年。

例如,1900年不是闰年,2004是闰年。

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

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

试题程序:

include<stdio.h>

include<conio.h>

int fun(int n)

{

int flag=0;

if (n%4=0)

{

if (【 】)

flag=1;

}

if (【 】)

flag=1;

return【 】;

}

main()

{

int year;

clrscr();

printf("Input the year:");

scanf("%d", &year);

if (fun(year))

printf("%d is a leap year. \n", year);

else

printf("%d is not a leap year.\n",

year);

}

点击查看答案

第5题

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。 注意:部分

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。

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

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

试题程序:

include <stdio.h>

define N 80

int fun (char s[],char ch)

{

int i=0, n=0;

while(【 】)

{

if(【 】)

n++;

i++;

}

【 】;

}

main ()

{

int n;

char str[N], ch;

clrscr ();

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

gets (str);

printf ("\nInput a charactor: \n" ;

scanf ("%c", &ch);

n=fun (str, ch);

printf("\nnumber of %c:%d", ch, n);

}

点击查看答案

第6题

请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。 例如:字符串中原有的字符串为abcd

请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。

例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容变为edcba。

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

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

试题程序:

$include<string.h>

include<conio.h>

include<stdio.h>

define N 81

void fun(char*s)

{

int i=0,t,n=strlen(s);

for(;【 】;i++)

{

t=*(s+i);

【 】;

【 】;

}

}

main()

{

char a[N];

clrscr();

printf("Enter a string:");

gets(a);

printf("The original string is:");

puts(a);

fun(a);

printf("\n");

printf("The string after modified:");

puts(a);

}

点击查看答案

第7题

●试题四 请补充函数fun(),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符

●试题四

请补充函数fun(),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入"Are you come from Sichuan?",则输入"are you come from sichuan?"。

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

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

试题程序:

#include<stdio.h>

#include<string.h>

#include<conio.h>

char *fun(char tt[])

{

int i;

for(i=0;tt[i];i++)

{

if((tt[i]>=′A′)&&((1) ))

(2) ;

}

return ((3) ) ;

}

main()

{

char tt[81];

printf("\nPlease enter a string:");

gets(tt);

printf("\nThe result string is: \n%s",

fun(tt));

}

点击查看答案

第8题

请补充函数fun(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符

请补充函数fun(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。

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

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

试题程序:

include<stdio.h>

include<conio.h>

void fun(char *s)

{

int i=0;

char *p=s;

while(【 】)

{

if (*p>='a'&&*p<='z')

{

s[i]=*p;

【 】;

}

p++;

}

s[i]=【 】;

}

main()

{

char str[80];

clrscr();

printf("\nEnter a string:");

gets(str);

printf("\n\nThe string is:\%s\n",str);

fun(str);

printf("\n\nThe string of changing

is:\%s\n",str);

}

点击查看答案

第9题

请补充函数fun(),该函数的功能是判断一个数是否为回文数。当字符串是回文时,函数返回字符申:yes!,

请补充函数fun(),该函数的功能是判断一个数是否为回文数。当字符串是回文时,函数返回字符申:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如:abcba。

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

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

试题程序:

include<string.h>

include<stdio.h>

char *fun(char*str)

{

char *p1,*p2;

int i, t=0;

p1=str;p2=str+strlen(str)-1;

for (i=0;【 】;i++)

if(【 】)

{

t=1;

break;

}

if (【 】)

return("yes!");

else

return("no!");

}

main()

{

char str[50];

printf("Input;");

scanf("%s",str);

printf("%s\n",fun(str));

}

点击查看答案

第10题

请补充函数fun(),该函数的功能是:求100(不包括100)以内能被2或5整除,但不能同时被2和5整除的自然

请补充函数fun(),该函数的功能是:求100(不包括100)以内能被2或5整除,但不能同时被2和5整除的自然数。结果保存在数组bb中,函数fun()返回数组比元素的个数。

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

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

试题程序:

include <stdio.h>

define N 100

int fun (int bb [] )

{

int i, j;

for(【 】;i<100; i++)

if ((i%1!=0&&i%5==0)|| (i%2==0&&i%5 !=0)

【 】;

【 】;

}

main()

{

int i, n;

int bb [N];

clrscr ();

n=fun (bb);

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

{

if (i%10==0)

printf ("\n");

printf ("% 4d", bb [i]);

}

}

点击查看答案
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
温馨提示
每个试题只能免费做一次,如需多次做题,请购买搜题卡
立即购买
稍后再说
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
赏学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反赏学吧购买须知被冻结。您可在“赏学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
赏学吧
点击打开微信