题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2017

题目大意:统计数字出现的次数,但是要注意输入字符时,要清流。。要吸收一个回车。还有注意输入时的格式~

 1 #include<stdio.h>
 2 int main()
 3 {
 4     int n;
 5     char c;
 6     scanf("%d\n",&n);
 7     while(n--)
 8     {
 9         int a=0;
10         while((c=getchar())!='\n')
11         {
12             if(c>='0'&&c<='9')
13                 a++;
14         }
15         printf("%d\n",a);
16     }
17 }

 

相关文章:

  • 2022-12-23
  • 2022-01-06
  • 2022-01-02
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
猜你喜欢
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案