题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-22 17:43:46

[填空题]请补充main 函数,该函数的功能是:计算两个自然数n和m(m<10000)之间所有数的和(n和m从键盘输入)。
例如:当n=1,m=100时,sum=5050:当n=100,m=1000时,sum=495550。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main 函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
main ( )

int n, m;
long sum;
【1】
clrscr ( );
printf ("/nInput n,m/n");
scanf ("%d, %d", &n, &m);
while (n<=m)

【2】
n++;

printf ("sum=% 【3】 /n", sum);

更多"请补充main 函数,该函数的功能是:计算两个自然数n和m(m<100"的相关试题:

[填空题]请补充main 函数,该函数的功能是:计算两个自然数n和m(m<10000)之间所有数的和(n和m从键盘输入)。
例如:当n=1,m=100时,sum=5050:当n=100,m=1000时,sum=495550。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main 函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
main ( )

int n, m;
long sum;
【1】
clrscr ( );
printf ("/nInput n,m/n");
scanf ("%d, %d", &n, &m);
while (n<=m)

【2】
n++;

printf ("sum=% 【3】 /n", sum);

[填空题]请补充main函数,该函数的功能是:从键盘输入只有两个整数参与运算的一个四则运算式,然后计算出它的值。注意数字全部为正整数。
例如,输入308*28,结果为8624.000000。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
# include<stdio, h>
main ( )

int a=0, b=0, flag=l, fg=l;
float result;
char *p, ch;
char str[10];
clrscr ( );
printf("/n Input a string /n");
gets (str);
p=str;
while (*p)

if (*p>=’0’ &&*p<=’9’ && flag==l )
a= 【1】 ;
else
if (fg)

ch=*p;
flag=2;
fg=0;

if (*p>=’0 ’ &&*p<=’9’ &&flag==2)
b= 【2】 ;
p++;

switch( 【3】 )

case ’+’: result=a+b;break;
case ’-’: result=a-b;break;
case ’*’ :result=a*b;break;
case ’/’ :result= (float) a/b;break;
printf ("/nresult=%f", re
[填空题]请补充main函数,该函数的功能是:输入两个正整数m和n,求这两个数的最大公约和最小公倍数。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> main ( ) { int a, b, n, m, t; clrscr ( ); printf ("/nInput two numbers: /n"); scanf ("%d, %d", &n, &m); if (n<m) { a=m; b=n; } else { a=n; b=m; } while( 【1】 ) { t= 【2】 a=b; b=t; } printf ("greatest con. non divisor: %d/n", a); printf ("least common multiple: %d/n", 【3】 ); }
[填空题]请补充main函数,该函数的功能是:输入两个正整数m和n,求这两个数的最大公约和最小公倍数。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
main ( )

int a, b, n, m, t;
clrscr ( );
printf ("/nInput two numbers: /n");
scanf ("%d, %d", &n, &m);
if (n<m)

a=m;
b=n;

else

a=n;
b=m;

while( 【1】 )

t= 【2】
a=b;
b=t;

printf ("greatest con. non divisor:
%d/n", a);
printf ("least common multiple:
%d/n", 【3】 );

[简答题]请补充函数fun( ),该函数的功能是:寻找两个整数之间的的所有素数(包括这两个整数),把结果保存在数组bb中,函数返回素数的个数。 例如,输入6和21,则输出为:7 11 13 17 19 21。 注意:部分源程序给出如下。 请勿改动主函数main 和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<conio. h> #include<stdio. h> #define N 1000 int fun (int n, int m, int bb [N]) { int i, j, k=0, flag; for (j=n; j<=m; j++) { 【1】 ; for (i=2; i<j; i++) if( 【2】 ) { flag=0; break; } if( 【3】 ) bb [k++] =j } return k; } main ( ) { int n=0,m=0, i, k; int bb[N]; clrscr ( ); printf ("Input n/n"); scanf ("%d", &n); printf ("Input m/n"); scanf ("%d", &m); for (i=0; i<m-n; i++) bb[i]=0; k=fun (n, m, bb); for (i=0; i<k; i++) printf ("%4d",bb [i]); }
[填空题]请补充main函数,该函数的功能是:计算三名学生学科的平均成绩。 例如,当score[N][M]={{83.5,82,86,65,67},{80,91.5,84, 99,95},{90,95,86,95,97}时,五门学科的平均分为:84.5 89.5 85.3 86.3 86.3。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: # include<stdio, h> #define N 3 #define M 5 main ( ) { int i,j; static float score [N] [M]= { {83.5, 82,86, 65,67}, {80,91.5,84,99,95}, {90, 95, 86, 95, 97} }; static float bb[N]; clrscr ( ); for ( i=0; i<M; i++) bb[i]=0.0; for(i=0;i< 【1】 ;i++) { for(j=0;j< 【2】 ;j++) bb [j]+=score [i] [j]; } for (i=0; i<M; i++) print f (" /nsubject%d/taverage=%5.1 f", i+1, 【3】 ); return 0; }
[填空题]请补充main函数,该函数的功能是:计算每个学生成绩的平均分,并把结果保存在数组bb中。 例如,当scorer[N][M]={{83.5,82,86,65,67),{80,91.5,84, 99,95){90.5,95,86,95,97}}时,三个学生的平均分为76.7 89.9 92.7。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若千表达式或语句。 试题程序: #include<stdio.h> #define N 3 #define M 5 main( ) { int i,j; static float score[N][M]={{83.5,82,86, 65,67},{80,91.5,84,99,95},{90.5,95, 86,95,97}}; float bb[N]; clrscr( ); for(i=0;i<N;i++) 【1】; for(i=0;i<N;i++) { for (j=0; j<M; j++) 【2】; bb [i]/=M; } for (i=0; i<N; i++) print f (" knstudent %d/t average =%5.1f",i+l,bb[i]); }
[填空题]请补充main函数,该函数的功能是:计算每个学生成绩的平均分,并把结果保存在数组bb中。
例如,当scorer[N][M]=83.5,82,86,65,67),80,91.5,84, 99,95)90.5,95,86,95,97时,三个学生的平均分为76.7 89.9 92.7。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若千表达式或语句。
试题程序:
#include<stdio.h>
#define N 3
#define M 5
main( )

int i,j;
static float score[N][M]=83.5,82,86,
65,67,80,91.5,84,99,95,90.5,95,
86,95,97;
float bb[N];
clrscr( );
for(i=0;i<N;i++)
【1】;
for(i=0;i<N;i++)

for (j=0; j<M; j++)
【2】;
bb [i]/=M;

for (i=0; i<N; i++)
print f (" knstudent %d/t average
=%5.1f",i+l,bb[i]);

[填空题]请补充main( )函数,该函数的功能是:计算每个学生成绩的平均分,并把结果保存在数组aver中。
例如,当score[N][M]=(83.5,82,86,65,67,80,91.5,84,99,95,90.5,95,86,95,97时,3个学生的平均分为76.7 89.9 92.7。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在main( )函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#define N 3
#define M 5
void main( )

int i,j;
static float score[N][M]=(83.5,82,86,65,67),80,91.5,84,99,95,90.5,95,86,95,97;
float aver[N];
system("CLS");
for(i=0;i<N;i++)
(1)
for(i=0;i<N;i++)

for(j=0;j<M;j++)
(2)
aver[i]/=M;

for(i=0;i<N;i++)
printf("/nstudent%dktaverage=%5.1f",i+1,aver[i]);


[填空题]请补充main函数,该函数的功能是求方程ax2+bx+c=0的两个实数根。方程的系数a、b、c从键盘输入,如果判别式(disc=b*b-4*a*c)小于0,则要求重新输入a、b、c的值。
例如,当a=1,b=2,c=1时,方程的两个根分别是:x1=-1.00,x2=-1.00。
注意:部分源程序已给出。
请勿改动函数中的其他任何内容,仅在横线上填入所编写的若干表达式或语句。
试题程序:
#include<math.h>
#include<stdio.h>
void main( )

double a,b,C,x1,x2,disc;
do

printf("Input a,b,c:");
scanf("%1f,%1f,%1f”,&a,&b,&c);
disc=b*b-4*a*c;
if(disc<0)
printf("disc=%1f/n Input again!/n",disc);

while( (1) );
printf("******the result******/n");
x1=(-b+ (2) (disc))/(2*a);
x2=(-b- (3) (disc))/(2*a);
printf("/nx1=%6.21f/nx2=%6.21fkn",x1,x2);


我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码