Chinaunix首页 | 论坛 | 博客

分类: C/C++

2014-11-27 22:57:27



  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int number;
  5.     scanf( "%d",&number);
  6.     if (number < 0 )
  7.     {
  8.         printf(" you input the wrong number \n");
  9.         return 0;
  10.     }

  11.     else if (number <= 9)
  12.     {
  13.         if (number >= 0 )
  14.         {
  15.             printf(" 输出的是一位数\n");
  16.         }
  17.     }
  18.     else if (number <= 99)
  19.     {
  20.         if (number >= 10)
  21.         {
  22.             printf("输出的是两位数\n");
  23.         }
  24.     }

  25.     else if (number <= 999)
  26.     {
  27.         if ( number >= 100)
  28.         {
  29.             printf("输出的是三位数\n");
  30.         }
  31.     }
  32.     else if (number <= 9999)
  33.     {
  34.         if ( number >= 1000)
  35.         {
  36.             printf("输出的是四位数\n");
  37.         }
  38.     }
  39.     else if (number <= 99999)
  40.     {
  41.         if ( number >= 10000)
  42.         {
  43.             printf("输出的是五位数\n");
  44.         }
  45.     }
  46.     return 0;
  47. }


阅读(1380) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~