2011年计算机二级C语言第五十五套上机题库及答案

2014-11-23 22:29:34 · 作者: · 浏览: 40

  例如,输入一个数:27638496,新的数:为739。


  请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。


  注意:源程序存放在考生文件夹下BLANK1.C中。


  不得增行或删行,也不得更改程序的结构!


  给定源程序:


  #include


  void fun(unsigned long *n)


  {unsigned long x=0, i; int t;


  i=1;


  while(*n)


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


  {t=*n % __1__;


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


  if(t%2!= __2__)


  {x=x+t*i; i=i*10;}


  *n =*n /10;


  }


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


  *n=__3__;


  }


  main()


  {unsigned long n=-1;


  while(n>99999999||n<0)


  {printf("Please input(0


  fun(&n);


  printf("\nThe result is: %ld\n",n);


  }


  解题答案:


  /**********第一空**********/


  {t=*n % 10 ;


  /**********第二空*********/


  if(t%2!= 0)


  /**********第三空*********/


  *n=x;


  ******************************************


  相关专题:


  编辑推荐: