APP下载
首页
>
文学知识
>
C语言程序设计题库
搜索
C语言程序设计题库
题目内容
(
单选题
)
15.下面程序运行时若输入c2470f?<回车>后,则输出结果是_______。
#include
int main()
{ char ch;
long number=0;
while( '6');
while(ch!='?'&&ch>='0'&&ch<='6')
{ number=number*7+ch-'0';
printf( );
ch=getchar();
}
return 0;
}

答案:LDNUMBER

C语言程序设计题库
40.下面程序在运行时,若输入3 11 8 5 15 9<回车>后输出结果是________。
#include
void sort( )
{ int i, k, temp;
for (i=1; i<6; i++)
for(k=i-1;k>=0&&b[k]{temp=b[k]; b[k]=b[k+1]; b[k+1]=temp; }
}
int main()
{ int k, a[6];
for(k=0; k<6; k++)
scanf( );
sort( );
for(k=0; k<6; k++)
printf("%3d", a[k]);
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-1288-c003-bc7499099f00.html
点击查看题目
8.一个完整的C程序可以有多个函数,其中有且只能有一个名为________的函数。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ee-f250-c003-bc7499099f03.html
点击查看题目
12.在下面程序的main()函数中,语句“f( );”内的实参a表示数组a的( )。
void f( )
{ int k; for( )a[k]++; }
int main()
{ int a[10]={0};f( ); return 0; }
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f4-e1d8-c003-bc7499099f00.html
点击查看题目
9.本程序的功能是:查找所有满足下面条件的两个整数对:(1)两个整数都是3位数;(2)组成两个整数各位的数字各不相同并且不出现数字0;(3)第二个数等于第一个数的两倍。例如,134和268就是满足该条件的一个整数对。
#include
int main()
{int a,b,c,j,k,w,e[6],sum;
for(a=1;a<=5;a++) /*a百位,b十位,c个位*/
for(b=1;b<=9;b++)
for(c=1;c<=9;c++)
{e[0]=a;e[1]=b;e[2]=c;
sum=a*100+b*10+c;
sum=2*sum;
if(sum>999)( (21) );
e[3]=sum/100;
e[4]=(sum-e[3]*100)/10;
e[5]=( (22) );
w=1;
for(j=0;j<5;j++)
for(k=0;k<6;k++)
if(e[k]==0||j!=k&&e[j]==e[k]) w=0;
if( )
for(k=0;k<2;k++)
if( )
printf("%d%d%d\n",e[k*3],e[k*3+1],e[k*3+2]);
else
printf("%d%d%d\t",e[k*3],e[k*3+1],e[k*3+2]);
}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f3-b510-c003-bc7499099f00.html
点击查看题目
12.下面程序的功能是:输出100以内(不含100)能被3整除且个位数为6的所有整数。请填空。
#include
int main()
{int i,j;
for(i=0;( (24) );i++)
{j=i*10+6;
if(( (25) ))
printf("%3d",j);
}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f2-5198-c003-bc7499099f00.html
点击查看题目
11.B12.D13.C14.B15.C16.A17.D18.A
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-4a10-c003-bc7499099f01.html
点击查看题目
5.已有预处理命令和定义如下:
#define N 8
int x=2, z=1;
double y=1.2;
下述程序段正确的是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-f208-c003-bc7499099f00.html
点击查看题目
11.下面程序是用递归算法求m与n的最大公约数。
设求m与n的最大公约数的函数为gcd( ),则递归公式为:

#include
int gcd( )
{int k;
if(( (30) ))
k=m;
else
k=( (31) );
return k;
}
int main()
{int m,n;
scanf( );
printf(
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-87b8-c003-bc7499099f00.html
点击查看题目
53.下面常量表示中正确的是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-bd70-c003-bc7499099f00.html
点击查看题目
44.下面选项中,可以作为用户标识符的是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-a600-c003-bc7499099f01.html
点击查看题目
首页
>
文学知识
>
C语言程序设计题库
题目内容
(
单选题
)
手机预览
C语言程序设计题库

15.下面程序运行时若输入c2470f?<回车>后,则输出结果是_______。
#include
int main()
{ char ch;
long number=0;
while( '6');
while(ch!='?'&&ch>='0'&&ch<='6')
{ number=number*7+ch-'0';
printf( );
ch=getchar();
}
return 0;
}

答案:LDNUMBER

分享
C语言程序设计题库
相关题目
40.下面程序在运行时,若输入3 11 8 5 15 9<回车>后输出结果是________。
#include
void sort( )
{ int i, k, temp;
for (i=1; i<6; i++)
for(k=i-1;k>=0&&b[k]{temp=b[k]; b[k]=b[k+1]; b[k+1]=temp; }
}
int main()
{ int k, a[6];
for(k=0; k<6; k++)
scanf( );
sort( );
for(k=0; k<6; k++)
printf("%3d", a[k]);
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-1288-c003-bc7499099f00.html
点击查看答案
8.一个完整的C程序可以有多个函数,其中有且只能有一个名为________的函数。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ee-f250-c003-bc7499099f03.html
点击查看答案
12.在下面程序的main()函数中,语句“f( );”内的实参a表示数组a的( )。
void f( )
{ int k; for( )a[k]++; }
int main()
{ int a[10]={0};f( ); return 0; }
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f4-e1d8-c003-bc7499099f00.html
点击查看答案
9.本程序的功能是:查找所有满足下面条件的两个整数对:(1)两个整数都是3位数;(2)组成两个整数各位的数字各不相同并且不出现数字0;(3)第二个数等于第一个数的两倍。例如,134和268就是满足该条件的一个整数对。
#include
int main()
{int a,b,c,j,k,w,e[6],sum;
for(a=1;a<=5;a++) /*a百位,b十位,c个位*/
for(b=1;b<=9;b++)
for(c=1;c<=9;c++)
{e[0]=a;e[1]=b;e[2]=c;
sum=a*100+b*10+c;
sum=2*sum;
if(sum>999)( (21) );
e[3]=sum/100;
e[4]=(sum-e[3]*100)/10;
e[5]=( (22) );
w=1;
for(j=0;j<5;j++)
for(k=0;k<6;k++)
if(e[k]==0||j!=k&&e[j]==e[k]) w=0;
if( )
for(k=0;k<2;k++)
if( )
printf("%d%d%d\n",e[k*3],e[k*3+1],e[k*3+2]);
else
printf("%d%d%d\t",e[k*3],e[k*3+1],e[k*3+2]);
}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f3-b510-c003-bc7499099f00.html
点击查看答案
12.下面程序的功能是:输出100以内(不含100)能被3整除且个位数为6的所有整数。请填空。
#include
int main()
{int i,j;
for(i=0;( (24) );i++)
{j=i*10+6;
if(( (25) ))
printf("%3d",j);
}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f2-5198-c003-bc7499099f00.html
点击查看答案
11.B12.D13.C14.B15.C16.A17.D18.A
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-4a10-c003-bc7499099f01.html
点击查看答案
5.已有预处理命令和定义如下:
#define N 8
int x=2, z=1;
double y=1.2;
下述程序段正确的是( )。

A.  switch(x)

B.  switch(x)
{ case z: x--;break; {case N>0:x=1;break;
case z+1: x++;break; case 1:x=0;break;
}}

C.  switch(x)

D.  switch(y)
{ case 2: y++;break; {case 1.0:y++;break;
case '0': y=3; case 1.2:y=1;break;
} }

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-f208-c003-bc7499099f00.html
点击查看答案
11.下面程序是用递归算法求m与n的最大公约数。
设求m与n的最大公约数的函数为gcd( ),则递归公式为:

#include
int gcd( )
{int k;
if(( (30) ))
k=m;
else
k=( (31) );
return k;
}
int main()
{int m,n;
scanf( );
printf(
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-87b8-c003-bc7499099f00.html
点击查看答案
53.下面常量表示中正确的是( )。

A.  \xff

B.  3L

C.  aEb

D.  3.14U

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-bd70-c003-bc7499099f00.html
点击查看答案
44.下面选项中,可以作为用户标识符的是( )。

A.  6_6

B.  void

C.  unsigned

D.  _0_

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-a600-c003-bc7499099f01.html
点击查看答案
试题通小程序
试题通app下载