[高等教育]第三章-循环结构.pptVIP

  • 292
  • 0
  • 约9.81千字
  • 约 32页
  • 2018-03-05 发布于浙江
  • 举报
[高等教育]第三章-循环结构

1.某托儿所收2岁到6岁的孩子,2岁、3岁孩子进小班(Lower class);4岁孩子进中班(Middle class);5岁、6岁孩子进大班(Higher class)。编写程序(用switch语句),输入孩子年龄,输出年龄及进入的班号。 #includestdio.h void main() {int age; printf(please input age between 2 to 6:\n); scanf(%d,age); switch(age) {case 2: case 3:printf(the child id %d year old,he should enter lower class.\n,age);break; case 4:printf(the child id %d year old,he should enter middle class\n.,age);break; case 5: case 6:printf(the child id %d year old,he should enter higher class\n.,age);break; default: printf(please input age between 2 to 6:\n); } } 2.自守数是其平方后尾数等于该数自身的自然数。例如:   ?25*25

文档评论(0)

1亿VIP精品文档

相关文档