首页 > 编程语言 > 编写程序数一下 1到 100 的所有整数中出现多少个数字9

编写程序数一下 1到 100 的所有整数中出现多少个数字9

时间:2023-02-28 23:33:16浏览次数:33  
标签:count 10 头文件 编写程序 int 数一下 100 include 库函数

#define _CRT_SECURE_NO_WARNINGS 1//防止scanf报警

#include <stdio.h>//头文件中包括了各种标准库函数的函数原型

//#include<string.h>//C语言标准库中一个常用的头文件,在使用到字符数组时需要使用

//#include<windows.h>//头文件封装了许多库函数以及一些类,将一些复杂的工作由库函数处理

//#include<stdlib.h>//include<stdio.h>称为编译预处理命令

int main()

{

int i = 1;

int count=0;

for (i = 1; i <= 100; i++)

{

 if (i % 10 == 9)

  count ++;

 if (i / 10== 9)

  count ++;

}

printf("%d", count);

return 0;//放最后

}

标签:count,10,头文件,编写程序,int,数一下,100,include,库函数
From: https://blog.51cto.com/u_15981182/6091874

相关文章