填空题
输入2个整数,输出它们的最小公倍数和最大公约数。 #include<stdio.h> void main() {int m,n,gbs,gys; scanf("%d,9/6d",m,n); gbs=m; while(______)/*第一空*/ gbs=______;/*第二空*/ gys=______;/*第三空*/ printf("%d %d\n",gbs,gys); }
【参考答案】
gbs%n!=0/*第一空。确定循环终止的条件,当gbs%n=0时循环终止*/
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
问答题
#include<stdio.h> #include%<string.h> main() {char p1[10]= abc ,p2[10]= ABC ,str[50]= xyz : strcpy(str+2,strcat(p1,p2)): printf( %s n ,str); }
点击查看答案
填空题
下面程序由终端键盘输入一个文件名。然后把从终端键盘输入的字符依次存放到该文件中,用#作为结束输入的标志。 #include<stdio.h> #include main() {FILE *fp; char ch,fname[10]; printf( Please input the file name. n ); gets(fname); if((fp=______)==NULL) *第一空* {printf( ()pen it error n );______;} *第二空* else(printf( Enter the content n ); while((ch=getchar())!=’#’) ______; *第三空* } fclose(fp); }
点击查看答案&解析
相关试题
根据Fibonacci数列公式: 计算并输出前2...