APP下载
首页
>
文学知识
>
C语言程序设计题库
搜索
C语言程序设计题库
题目内容
(
单选题
)
3.在窗体上以每行两个数的格式输出所有的“水仙花数”。所谓“水仙花数”是指一个三位数,其各位数字的立方和等于该数本身。(提示:首先分离出每位数字)
#include
int main()
{ int i,a,b,c,n=0;
for(i=100;i<=999;i++)
{ a=i/100;
b=(i-a*100)/10;
c=i%10;
if( )
{ printf( );
n++;
if(n%2==0) printf( );
}
}
return 0;
}

答案:N

C语言程序设计题库
26.已有定义语句“char ch1[10]= "12345", ch2[10]= "abcde", ch3[10];”,下面语句中能将ch1中存储的字符串和ch2中存储的字符串正确交换的是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f2-fd78-c003-bc7499099f00.html
点击查看题目
1.下面叙述正确的是()。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-34b8-c003-bc7499099f00.html
点击查看题目
35.下面程序运行后输出的结果是()。
#include
int f( )
{ int i, j, m=0, c, k;
for(i=0; i<n; i++)
{ k=a[i]; c=1;
for(j=i+1; j<n; j++)
if( )c++;
else {i=j-1; break; }
if( )i=j;
if(c==1) b[m++]=k;
else {b[m++]=-c; b[m++]=k;}
}
return m;
}
int main()
{ int a[]={5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, b[10], i, j, n=10;
n=f( );
for(i=0; i<n; i++)
{ if(i%2==0) printf( );
printf("%3d", b[i]);}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-f730-c003-bc7499099f00.html
点击查看题目
4.下面程序的功能是:根据下列公式计算cos( )的近似值。精度要求:当通项的绝对值小于等于10-6时为止。

#include
#include<( (10) )>
double mycos( )
{ int n=1;
double s=0, t=1.0;
while (( (11) )>=1e-6)
{s+=t;
t*= ( (12) );
n=n+2;
}
return s;
}
int main()
{ double x;
scanf( );
printf( ;
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-4550-c003-bc7499099f00.html
点击查看题目
12.已有定义“int a=2, b=3; float m=4.5, n=3.5;”,则表达式“( )( )/2+( )m%( )n”的值是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-2518-c003-bc7499099f03.html
点击查看题目
2.输入输出的格式控制字符中,int型数据采用________,float型数据采用________,char型数据采用________。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-ec50-c003-bc7499099f02.html
点击查看题目
37.以下关于函数形式参数的声明中正确的是________。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-33e0-c003-bc7499099f00.html
点击查看题目
29.下面程序运行后输出结果是________。
#include
void fun( )
{ if(n<100)
printf("%d", n/10);
else
{ fun(n/100); printf("%d", n%100/10); }
}
int main()
{ fun(123456); return 0;}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-d020-c003-bc7499099f00.html
点击查看题目
16.数学表达式所对应的C语言表达式为( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-e268-c003-bc7499099f01.html
点击查看题目
1.已有定义“int a=3, b=4, c=5;”,则下列表达式中值为0的是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-e650-c003-bc7499099f00.html
点击查看题目
首页
>
文学知识
>
C语言程序设计题库
题目内容
(
单选题
)
手机预览
C语言程序设计题库

3.在窗体上以每行两个数的格式输出所有的“水仙花数”。所谓“水仙花数”是指一个三位数,其各位数字的立方和等于该数本身。(提示:首先分离出每位数字)
#include
int main()
{ int i,a,b,c,n=0;
for(i=100;i<=999;i++)
{ a=i/100;
b=(i-a*100)/10;
c=i%10;
if( )
{ printf( );
n++;
if(n%2==0) printf( );
}
}
return 0;
}

答案:N

分享
C语言程序设计题库
相关题目
26.已有定义语句“char ch1[10]= "12345", ch2[10]= "abcde", ch3[10];”,下面语句中能将ch1中存储的字符串和ch2中存储的字符串正确交换的是( )。

A.  ch3=ch1,ch1=ch2, ch2=ch3;

B.  ch3[0]=ch1[0],ch1[0]=ch2[0],ch2[0]=ch3[0];

C.  strcpy(ch3[0],ch1[0]),strcpy(ch1[0],ch2[0]),strcpy(ch2[0],ch3[0]);

D.  strcpy(ch3,ch1), strcpy(ch1, ch2), strcpy(ch2, ch3);

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f2-fd78-c003-bc7499099f00.html
点击查看答案
1.下面叙述正确的是()。

A.  C程序在运行时总是从main()函数开始逐条执行语句的

B.  main()函数是系统库函数

C.  main()函数中每行只能出现一条语句

D.  main()函数必须出现在所有其他函数之前

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-34b8-c003-bc7499099f00.html
点击查看答案
35.下面程序运行后输出的结果是()。
#include
int f( )
{ int i, j, m=0, c, k;
for(i=0; i<n; i++)
{ k=a[i]; c=1;
for(j=i+1; j<n; j++)
if( )c++;
else {i=j-1; break; }
if( )i=j;
if(c==1) b[m++]=k;
else {b[m++]=-c; b[m++]=k;}
}
return m;
}
int main()
{ int a[]={5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, b[10], i, j, n=10;
n=f( );
for(i=0; i<n; i++)
{ if(i%2==0) printf( );
printf("%3d", b[i]);}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-f730-c003-bc7499099f00.html
点击查看答案
4.下面程序的功能是:根据下列公式计算cos( )的近似值。精度要求:当通项的绝对值小于等于10-6时为止。

#include
#include<( (10) )>
double mycos( )
{ int n=1;
double s=0, t=1.0;
while (( (11) )>=1e-6)
{s+=t;
t*= ( (12) );
n=n+2;
}
return s;
}
int main()
{ double x;
scanf( );
printf( ;
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-4550-c003-bc7499099f00.html
点击查看答案
12.已有定义“int a=2, b=3; float m=4.5, n=3.5;”,则表达式“( )( )/2+( )m%( )n”的值是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-2518-c003-bc7499099f03.html
点击查看答案
2.输入输出的格式控制字符中,int型数据采用________,float型数据采用________,char型数据采用________。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-ec50-c003-bc7499099f02.html
点击查看答案
37.以下关于函数形式参数的声明中正确的是________。

A.  int a[ ]

B.  int a[ ][ ]

C.  int a[ ]={0}

D.  int a[2][ ]

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-33e0-c003-bc7499099f00.html
点击查看答案
29.下面程序运行后输出结果是________。
#include
void fun( )
{ if(n<100)
printf("%d", n/10);
else
{ fun(n/100); printf("%d", n%100/10); }
}
int main()
{ fun(123456); return 0;}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-d020-c003-bc7499099f00.html
点击查看答案
16.数学表达式所对应的C语言表达式为( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-e268-c003-bc7499099f01.html
点击查看答案
1.已有定义“int a=3, b=4, c=5;”,则下列表达式中值为0的是( )。

A.  a&&b

B.  a<=b

C.  a||b&&c

D.  !(!c||1)

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