logo

咨询热线

15020086924 (点击在线咨询)
您现在的位置:山东自考网>自考试题 > 正文
自考攻略

2023年4月山东自考《C语言程序设计》练习题及答案

时间:2023-02-16 14:05:02 作者:储老师

自考助学   2023年4月山东自考正在备考阶段,山东自考网会持续为大家更新关于山东自考报名、山东自学考试免考、山东自学考试时间、山东自考复习资料等相关内容,想要了解的考生可以关注山东自考网。

  程序填空题

  导读:在程序填空题中,已经给出了程序的主干,读者首先要理解程序的思路,再选择正确的内容填入空白处,使程序完成既定的功能。这类习题的设计就是要引导读者逐步掌握编程的方法。本节习题的难度适中,可能有些典型的程序在课堂上已经有所接触,读者一定要独立完成它,这样就可以逐步提高自己的编程能力。在程序设计语言学习的中期,读者对程序设计已经有了初步的了解,而自己编写程序又不知从何处入手,此时解答此类题目可以避免盲目性,从而提高学习的效率。

  

  #include

  main()

  { int a,b;

  scanf("%d%d",&a,&b);

  printf("a=%d,b=%dn",a,b);

  a= ① ;

  b= ② ;

  a= ③ ;

  printf("a=%d,b=%dn",a,b);

  }

  

  #include

  double pi(long n)

  { double s=0.0;

  long i;

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

  s=s+ ① ;

  return( ② );

  }

  

  findmin(int *s,int t,int *k)

  { int p;

  for(p=0,*k=p;p

  if(s[p]

  ① ;

  }

  main()

  { int a[10],i,*k=&i;

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

  scanf("%d",&a[i]);

  findmin(a,10,k);

  printf("%d,%dn",*k,a[*k]);

  }

  

  main()

  { int i,t=1,s=0;

  for(i=1;i<=101;i+=2)

  { ① ;

  s=s+t;

  ② ;

  }

  printf("%dn",s);

  }

  

  s=1.0;

  for(k=1;k<=n;k++)

  s=s+1.0/(k*(k+1));

  printf("%fn",s);

  填空完成下述程序,使之与上述程序的功能完全相同。

  s=0.0;

  ① ;

  k=0;

  do

  { s=s+d;

  ② ;

  d=1.0/(k*(k+1));

  }while( ③ );

  printf("%fn",s);

  

  main()

  { float x,amax,amin;

  scanf("%f",&x);

  amax=x;

  amin=x;

  while( ① )

  { if(x>amax) amax=x;

  if( ② ) amin=x;

  scanf("%f",&x);

  }

  printf("namax=%fnamin=%fn",amax,amin);

  }

  

  fun(int x,int b[])

  { int k=0,r;

  do

  { r=x% ① ;

  b[k++]=r;

  x/= ② ;

  }while(x);

  }

  

  main()

  { int n,k=1,s=0,m;

  for(n=1;n<=100;n++)

  { k=1;

  s=0;

  ① ;

  while( ② )

  { k*=m%10;

  s+=m%10;

  ③ ;

  }

  if(k>s)

  printf("%d",n);

  }

  }

  

  main()

  { int i,j,k,count=0;

  for(i=1;i<=9;i++)

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

  if( ① ) continue;

  else for(k=0;k<=9;k++)

  if( ② ) count++;

  printf("%d",count);

  }

  

  main()

  { int i,j;

  for(i=0; ① ;i++)

  { j=i*10+6;

  if( ② ) countinue;

  printf("%d",j);

  }

  }

  

  hcf(int m,int n)

  { int r;

  if(m

  { r=m;

  ① ;

  n=r;

  }

  r=m%n;

  while( ② )

  { m=n;

  n=r;

  r=m%n;

  }

  ③ ;

  }

  

  #include

  main()

  { ① ;

  int i,j;

  printf("Input 10 numbers pleasen");

  for(i=0; ② ;i++ )

  scanf("%f", &a[i]);

  printf("n");

  for(i=2; ③ ;i++ )

  for(j=0; ④ ;j++ )

  if( ⑤ )

  { x=a[j];

  ⑥ ;

  a[j+1]=x;

  }

  printf("The sorted 10 numbers;n");

  for(i=0; ⑦ ;i++ )

  { if( ⑧ )

  printf("n");

  printf("%ft",a[i]);

  }

  printf("n");

  }

  

  #include "stdio.h"

  main()

  { int i,a[20],s,count;

  s=count=0;

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

  scanf("%d", ① );

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

  { if(a[i]<0)

  ② ;

  s+=a[i];

  count++;

  }

  printf("s=%dt count=%dn",s,count);

  }

  

  #include

  main()

  { char *s="Beijing ligong daxue";

  int i,j;

  for(i=j=0;s[i]!='0';i++)

  if(s[i]!= ' ') ① ;

  else ② ;

  s[j]= '0';

  printf("%s",s);

  }

  

  #include

  main( )

  { char s[80];

  int i,j;

  gets(s);

  for(i=j=0;s[i]!= '0';i++ )

  if(s[i]!= 'c') ① ;

  s[j]= '0';

  puts(s);

  }

声明:

(一)由于考试政策等各方面情况的不断调整与变化,本网站所提供的考试信息仅供参考,请以权威部门公布的正式信息为准。

(二)本网站在文章内容来源出处标注为其他平台的稿件均为转载稿,免费转载出于非商业性学习目的,版权归原作者所有。如您对内容、版权等问题存在异议请与本站联系,我们会及时进行处理解决。

考试提醒

准考证打印:10月21-26日

  • 考生交流群
  • 微信公众号
  • 考生交流群 扫一扫加入微信交流群

    与考生自由互动、并且能直接与专业老师进行交流解答。

  • 微信公众号 扫一扫加关注微信公众号

    与考生自由互动、并且能直接与专业老师进行交流解答。

关注公众号

回复“免费资料”领取复习资料

微信公众号

微信公众号

微信公众号

微信交流群

<<点击收起

在线咨询

在线咨询

联系方式
联系
微信
学习群
微信
学习群
反馈建议
反馈
建议
回到顶部
回到
顶部
APP下载
微信客服
微信交流群