当前位置:问答库>考研试题

2015年武汉科技大学855C语言程序设计(A卷答案)考研试题研究生入学考试试题考研真题

  摘要

参考答案(A)

一、选择题(每题2分,共30分)

1~5 ABBCD 6~10 ABCBD 11~15 DDCAC

二、读程序写结果(每题5分,共20分)

1. 500 2. 235 3. 6 4. 5432

三、程序填空题(每空2分,共50分)

1. (1)*(arr+n-1) (2)p-1 (3)m>0 (4)arr,n,m (5)&number[i]

2. (1)int day,month,year,sum (2)month (3)sum=59 (4)sum+=day (5)month>2

3. (1)char *p=a (2)*a!='*' (3)a++ (4)*p!='\0' (5)str

4. (1)*n=0 (2)i%7==0||i%11==0

5. (1)int i,n=0 (2)b[n]=a[i]

四、程序设计题(共50分)

1.

#include

int choushu(int n)

{

while(n%2==0) n=n/2;

while(n%3==0) n=n/3;

while(n%5==0) n=n/5;

while(n%7==0) n=n/7;

if(n==1) return 1;

else return 0;

}

int yzs(int n)

{

int i,s=0;

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

if(n%i==0) s++;

return s;

}

void main()

{

int m;

scanf("%d",&m);

if(choushu(m)) printf("%d\n",yzs(m));

else printf("no\n");

}

2.

#include

#include

struct node

{

int data;

struct node *next;

}; (3)(*n)++ (3)return n 4)&n 4)stu,h,low,high (5)(k+1)%5==0 (5)i