C语言程序设计试题集及其答案

if(ch2>ch3) ch3++; else --ch3;

printf(\ return 0; }

7. #include int main() {

float x,y; scanf(\ switch((int)x/10) { case

0:

printf(\ case

1: printf(\ case

2: printf(\ default:

printf(\ } return 0; }

y=1.0;

y=2*x+1;

y=3*x*x+2;

输入:15.3<回车> 8. #include int main() {

char ch1='A',ch2='B'; switch(ch1) {

case 'A':

switch(ch2) {

case 'B': printf(\ case 'A': printf(\ }

case 'B': printf(\ } return 0; } 9.

#include void main() {

float score; score = 100;

if (score<60) printf(\ else

switch( ( int ) score / 10 ) { case 10: case 9: printf(\ case 8: printf(\

case 7: printf(\ case 6: printf(\ default: printf(\ } }

10. #include void main() {

int i=0,a=2; if(i==0) printf(“**”); else

printf(“$$”); printf(“*”); } 11.

#include

void main() {

int m=10,n=0,p=4,q=20; if (m) if (n) q=15-m; else q=25+m; else if (p) q=q+p;

printf(“q=%d\\n”,q); }

12. #include void main() {

int a=1,b=0; switch(a) {

case 1: switch (b) {

case 0: printf(\ case 1:printf(\ }

case 2: printf(\

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4