计算机等级 > 二级考试 > C语言程序设计 > C语言模拟试题 > 文章内容

全国计算机等级考试C语言考试程序填空题(12)

2016-5-30编辑:ljnbset

在考生文件夹下,给定程序FILL.C的功能是:

从键盘上输入两个正整数x,y,求它们的最大公约数。

例如:如果从键盘上输入24,36,

程序的输出应为:max is : 12。

 

 #include

  #include

  #include

  void main()

  { int x,y,t,i;

    printf("Please enter two numbers:");

    scanf("%d,%d",&x,&y);

    if(x < y)

/************found************/

    {t = x; ____(1)____ ; y = t;}

x=y;

    t = x % y;

    while( t )

    { x = y;

       y=t;

       t = x % y;

    }

  /************found************/

   printf("max is : %d\n",____(2)____);

printf("maxis:%d\n",y);

}

全国计算机等级考试C语言考试程序填空题(11)

热点推荐

登录注册
触屏版电脑版网站地图