提交 c971eb7c 编写于 作者: W wizardforcel

2019-08-24 20:37:07

上级 99a9b0cd
......@@ -2,7 +2,7 @@
> 原文: [https://beginnersbook.com/2015/02/c-program-to-find-palindrome-numbers-in-a-given-range/](https://beginnersbook.com/2015/02/c-program-to-find-palindrome-numbers-in-a-given-range/)
在上一个教程中,我们学习了[如何检查数字是否是回文](https://beginnersbook.com/2015/02/c-program-to-check-if-a-number-is-palindrome-or-not/ "C Program to check if a number is palindrome or not")。在本教程中,我们将学习如何在给定范围内找到回文数。
在上一个教程中,我们学习了[如何检查数字是否是回文](https://beginnersbook.com/2015/02/c-program-to-check-if-a-number-is-palindrome-or-not/)。在本教程中,我们将学习如何在给定范围内查找回文数。
#### C 程序 - 在给定范围内生成回文数
......@@ -34,4 +34,5 @@ int main(){
```
**输出:**
![generating_palindrome_numbers_in_a_range](img/31d4edf5363d6820291ccc021e722217.jpg)
\ No newline at end of file
......@@ -30,6 +30,7 @@ int main()
```
**输出:**
![checking_even_odd_modulus_cmd](img/cd6f8865addd20756c352b8b5e04febb.jpg)
#### 程序 2:使用按位运算符
......@@ -57,4 +58,5 @@ int main()
```
**输出:**
![checking_even_odd_bitwise](img/4769c0554efeb10f752a1d1d9bf5e2d7.jpg)
\ No newline at end of file
......@@ -2,7 +2,7 @@
> 原文: [https://beginnersbook.com/2017/09/c-program-to-find-ascii-value-of-a-character/](https://beginnersbook.com/2017/09/c-program-to-find-ascii-value-of-a-character/)
ASCII 值表示英文字符为数字,每个字母分配一个 0 到 127 之间的数字。例如,大写`Q`的 ASCII 值为 81。
ASCII 值将英文字符表示为数字,每个字母分配一个 0 到 127 之间的数字。例如,大写`Q`的 ASCII 值为 81。
## 示例 1:显示用户输入的字符的 ASCII 值的程序
......@@ -38,7 +38,7 @@ ASCII value of character Q is: 81
查看相关的 [C 程序](https://beginnersbook.com/2015/02/simple-c-programs/)
1. [C 程序:展示斐波那契](https://beginnersbook.com/2014/06/c-program-to-display-fibonacci-series/)
1. [C 程序:展示斐波那契](https://beginnersbook.com/2014/06/c-program-to-display-fibonacci-series/)
2. [C 程序:检查数字是偶数还是奇数](https://beginnersbook.com/2015/02/c-program-to-check-if-number-is-even-or-odd/)
3. [C 程序:计算并打印 nPr](https://beginnersbook.com/2015/02/c-program-to-calculate-and-print-the-value-of-npr/) 的值
3. [C 程序:计算并打印 nPr 的值](https://beginnersbook.com/2015/02/c-program-to-calculate-and-print-the-value-of-npr/)
4. [C 程序:将大写字符串转换为小写](https://beginnersbook.com/2015/02/c-program-to-convert-uppercase-string-to-lowercase-string/)
\ No newline at end of file
# C 程序:找到`int`,`float`,`double`和`char`的大小
# C 程序:查找`int`,`float`,`double`和`char`的大小
> 原文: [https://beginnersbook.com/2017/09/c-program-to-find-the-size-of-int-float-double-andchar_](https://beginnersbook.com/2017/09/c-program-to-find-the-size-of-int-float-double-and-char/)
......@@ -31,8 +31,8 @@ Size of double: 8 bytes
看看这些相关的 C 程序:
1. [C 程序:加两个数字](https://beginnersbook.com/2017/09/c-program-to-add-two-numbers/)
1. [C 程序:加两个数字](https://beginnersbook.com/2017/09/c-program-to-add-two-numbers/)
2. [C 程序:查找数组中的元素数](https://beginnersbook.com/2017/09/c-program-to-find-the-number-of-elements-in-an-array/)
3. [C 程序:检查数字是正数还是负数](https://beginnersbook.com/2015/02/c-program-to-check-whether-the-given-integer-is-positive-or-negative/)
4. [C 程序:按升序排列数字](https://beginnersbook.com/2015/02/c-program-to-arrange-numbers-in-ascending-order/)
5. [C 程序:找到商和余数](https://beginnersbook.com/2017/09/c-program-to-find-quotient-and-remainder/)
\ No newline at end of file
5. [C 程序:查找商和余数](https://beginnersbook.com/2017/09/c-program-to-find-quotient-and-remainder/)
\ No newline at end of file
......@@ -48,4 +48,4 @@ E is a Vowel
2. [C 程序:将大写字符串转换为小写](https://beginnersbook.com/2015/02/c-program-to-convert-uppercase-string-to-lowercase-string/)
3. [C 程序:查找字符的 ASCII 值](https://beginnersbook.com/2017/09/c-program-to-find-ascii-value-of-a-character/)
4. [C 程序:在不使用预定义函数的情况下连接两个字符串](https://beginnersbook.com/2015/02/c-program-to-concatenate-two-strings-without-using-strcat/)
5. [C 程序:在不使用`strlen`](https://beginnersbook.com/2015/02/c-program-to-find-the-length-of-a-string/) 的情况下查找字符串的长度
\ No newline at end of file
5. [C 程序:在不使用`strlen` 的情况下查找字符串的长度](https://beginnersbook.com/2015/02/c-program-to-find-the-length-of-a-string/)
\ No newline at end of file
......@@ -6,13 +6,18 @@
## 示例:检查闰年的程序
您可以使用以下数学逻辑检查一年是否跳跃:
您可以使用以下数学逻辑检查一年是否是闰年:
**闰年:**
如果一年可以被 4,100 和 400 整除,则它是闰年。
如果一年可以被 4, 100 和 400 整除,则它是闰年。
如果一年可以被 4 整除但不能被 100 整除那么它就是闰年
**不是闰年:**
如果一年不能被 4 整除那么它不是闰年
如果一年可被 4 和 100 整除但不能被 400 整除那么它就不是闰年
让我们在 C 程序中编写这个逻辑。要了解该程序,您应该具有以下 [C 编程](https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/)主题的知识:
......
# C 程序:找到前 n 个自然数的和
# C 程序:查找前 n 个自然数的和
> 原文: [https://beginnersbook.com/2017/10/c-program-to-find-the-sum-of-first-n-natural-numbers/](https://beginnersbook.com/2017/10/c-program-to-find-the-sum-of-first-n-natural-numbers/)
程序找到前`n`个自然数的总和。我们将看到两个 C 程序来计算自然数的总和。在第一个 C 程序中,我们使用`for`循环查找总和,在第二个程序中,我们使用`while`循环执行相同操作。
程序查找前`n`个自然数的总和。我们将看到计算自然数的总和的两个 C 程序。在第一个 C 程序中,我们使用`for`循环查找总和,在第二个程序中,我们使用`while`循环执行相同操作。
要了解这些程序,您应该熟悉以下 [C 编程](https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/)概念:
1. [C 编程循环](https://beginnersbook.com/2014/01/c-for-loop/)
2. [C 循环编程](https://beginnersbook.com/2014/01/c-while-loop/)
1. [C 编程`for`循环](https://beginnersbook.com/2014/01/c-for-loop/)
2. [C 编程`while`循环](https://beginnersbook.com/2014/01/c-while-loop/)
## 示例 1:使用`for`循环查找自然数之和的程序
......@@ -77,7 +78,7 @@ Sum of first 7 natural numbers is: 28
看看这些相关的 C 程序:
1. [C 程序:查找数组元素之和](https://beginnersbook.com/2014/06/c-program-to-find-sum-of-array-elements-using-pointers-recursion-functions/)
2. [C 程序:加两个数字](https://beginnersbook.com/2017/09/c-program-to-add-two-numbers/)
3. [C 程序:找到商和余数](https://beginnersbook.com/2017/09/c-program-to-find-quotient-and-remainder/)
2. [C 程序:加两个数字](https://beginnersbook.com/2017/09/c-program-to-add-two-numbers/)
3. [C 程序:查找商和余数](https://beginnersbook.com/2017/09/c-program-to-find-quotient-and-remainder/)
4. [C 程序:交换两个数字](https://beginnersbook.com/2017/09/c-program-to-swap-two-numbers/)
5. [C 程序:查找数字的阶乘](https://beginnersbook.com/2014/06/c-program-to-find-factorial-of-number-using-recursion/)
\ No newline at end of file
......@@ -2,7 +2,7 @@
> 原文: [https://beginnersbook.com/2015/02/c-program-to-convert-uppercase-string-to-lowercase-string/](https://beginnersbook.com/2015/02/c-program-to-convert-uppercase-string-to-lowercase-string/)
在下面的 C 程序中,将要求用户输入一个字符串(它可以是完整的大写或部分大写),然后程序会将其转换为完整的(小写的所有字符)小写字符串。我们在以下程序中使用的逻辑是:所有大写字符(`A-Z`)的 ASCII 值范围为 65 到 90,它们对应的小写字符(`a-z`)的 ASCII 值大于它们的 32。例如`'A'`的 ASCII 值为 65,`'a'`的 ASCII 值为 97(`65 + 32`)。同样适用于其他字符。
在下面的 C 程序中,将要求用户输入一个字符串(它可以是完全大写或部分大写),然后程序会将其转换为完全(所有字符)小写的字符串。我们在以下程序中使用的逻辑是:所有大写字符(`A-Z`)的 ASCII 值范围为 65 到 90,它们对应的小写字符(`a-z`)的 ASCII 值比它们大 32。例如`'A'`的 ASCII 值为 65,`'a'`的 ASCII 值为 97(`65 + 32`)。同样适用于其他字符。
```c
......@@ -34,4 +34,5 @@ int main(){
**输出:**
![uppercase_to_lowercase_string_output](img/9bec7ec9a5e324356a2828d9d223ef71.jpg)
正如你在输出中看到的那样,我们输入了一个部分(只有少数字符大写)大写字符串,程序输出是一个完整的小写字符串。
\ No newline at end of file
正如你在输出中看到的那样,我们输入了一个部分(只有少数字符)大写字符串,程序输出是一个完全小写字符串。
\ No newline at end of file
......@@ -34,4 +34,5 @@ int main(){
**输出:**
![lowercase_to_uppercase_output](img/ef7d3791b39fd546a1916939b1f84fe0.jpg)
正如您在上面的截图中所观察到的,我们输入了一个小写字符串(`beginnersbook.com`)并将程序转换为大写字符串(`BEGINNERSBOOK.COM`
\ No newline at end of file
正如您在上面的截图中所观察到的,我们输入了一个小写字符串(`beginnersbook.com`)并且程序将其转换为大写字符串(`BEGINNERSBOOK.COM`
\ No newline at end of file
......@@ -4,7 +4,7 @@
在以下程序中,将要求用户输入一组字符串,程序将按字母顺序升序排序并显示它们。
#### C 程序 - 按升序字母顺序对一组字符串进行排序
#### C 程序 - 对一组字符串按字母顺序升序排序
```c
/* This program would sort the input strings in
......
......@@ -2,7 +2,7 @@
> 原文: [https://beginnersbook.com/2015/02/c-program-to-find-the-length-of-a-string/](https://beginnersbook.com/2015/02/c-program-to-find-the-length-of-a-string/)
在下面的 C 程序中,我们计算给定字符串中的字符数,以找出并在控制台上显示其长度。在执行该程序时,将要求用户输入字符串,然后程序将对字符进行计数并将输出字符串的长度显示为输出
在下面的 C 程序中,我们计算给定字符串中的字符数,并在控制台上显示其长度。在执行该程序时,将要求用户输入字符串,然后程序将对字符进行计数并输出字符串的长度
#### C 程序 - 在不使用标准库函数`strlen`的情况下查找字符串的长度
......
......@@ -40,5 +40,7 @@ int main()
```
**输出:**
![string_concat](img/142ec4c380af07e584b0d7e332bf221a.jpg)
正如您所看到的,我们已经输入了两个字符串,并且在程序的输出中两个字符串都被连接起来。
\ No newline at end of file
......@@ -62,4 +62,4 @@ int main()
2\. [C 程序:使用指针打印字符串](https://beginnersbook.com/2019/02/c-program-to-print-string-using-pointer/)
3\. [C 程序:到使用指针交换两个数字](https://beginnersbook.com/2019/02/c-program-to-swap-two-numbers-using-pointers/)
4\. [C 程序:创建初始化并访问指针变量](https://beginnersbook.com/2019/02/c-program-to-create-initialize-and-access-a-pointer-variable/)
5\. [C 程序:找到最大的三个数字而不使用指针](https://beginnersbook.com/2014/06/c-program-to-find-greatest-of-three-numbers/)
\ No newline at end of file
5\. [C 程序:查找最大的三个数字而不使用指针](https://beginnersbook.com/2014/06/c-program-to-find-greatest-of-three-numbers/)
\ No newline at end of file
......@@ -43,4 +43,4 @@ int main()
1\. [C 程序:用指针交换两个数字](https://beginnersbook.com/2019/02/c-program-to-swap-two-numbers-using-pointers/)
2\. [C 程序:创建,初始化并访问指针变量](https://beginnersbook.com/2019/02/c-program-to-create-initialize-and-access-a-pointer-variable/)
3\. [C 程序:查找前`n`个自然数的总和](https://beginnersbook.com/2017/10/c-program-to-find-the-sum-of-first-n-natural-numbers/)
4\. [C 程序:找到两个数的平均值](https://beginnersbook.com/2017/09/c-program-to-find-the-average-of-two-numbers/)
\ No newline at end of file
4\. [C 程序:查找两个数的平均值](https://beginnersbook.com/2017/09/c-program-to-find-the-average-of-two-numbers/)
\ No newline at end of file
......@@ -51,5 +51,5 @@ int main()
1\. [C 程序:检查闰年](https://beginnersbook.com/2017/09/c-program-to-check-leap-year/)
2\. [C 程序:交换两个数字](https://beginnersbook.com/2017/09/c-program-to-swap-two-numbers/)
3\. [C 程序:找到`int`,`float`,`double`和`char`的大小](https://beginnersbook.com/2017/09/c-program-to-find-the-size-of-int-float-double-and-char/)
3\. [C 程序:查找`int`,`float`,`double`和`char`的大小](https://beginnersbook.com/2017/09/c-program-to-find-the-size-of-int-float-double-and-char/)
4\. [C 程序:查找字符的 ASCII 值](https://beginnersbook.com/2017/09/c-program-to-find-ascii-value-of-a-character/)
\ No newline at end of file
# C 程序:找到商和余数
# C 程序:查找商和余数
> 原文: [https://beginnersbook.com/2017/09/c-program-to-find-quotient-and-remainder/](https://beginnersbook.com/2017/09/c-program-to-find-quotient-and-remainder/)
程序根据用户输入的被除数和除数找到**商****余数**
程序根据用户输入的被除数和除数查找**商****余数**
## 示例 1:用于查找商和余数的程序
在该程序中,要求用户输入被除数和除数,然后程序根据输入值找到商和余数。
在该程序中,要求用户输入被除数和除数,然后程序根据输入值查找商和余数。
```c
#include <stdio.h>
......
# C 程序:找到两个数字的平均值
# C 程序:查找两个数字的平均值
> 原文: [https://beginnersbook.com/2017/09/c-program-to-find-the-average-of-two-numbers/](https://beginnersbook.com/2017/09/c-program-to-find-the-average-of-two-numbers/)
......
# C 程序:找到最大的三个数字
# C 程序:查找最大的三个数字
> 原文: [https://beginnersbook.com/2014/06/c-program-to-find-greatest-of-three-numbers/](https://beginnersbook.com/2014/06/c-program-to-find-greatest-of-three-numbers/)
在本教程中,我们共享了一个程序,该程序比较三个输入整数并返回最大数字作为输出。为了进行这种比较,我们使用了一个简单的`if-elseif-else`块。
## 找到三个输入数字中的最大数字的程序
## 查找三个输入数字中的最大数字的程序
该程序将提示用户输入三个整数,并根据输入,它将比较并显示最大数字作为输出。在这个程序`num1, num2, num3`是三个`int`变量,依次表示`number1``number2``number3`
......
......@@ -2,9 +2,9 @@
> 原文: [https://beginnersbook.com/2014/06/c-program-to-find-factorial-of-number-using-recursion/](https://beginnersbook.com/2014/06/c-program-to-find-factorial-of-number-using-recursion/)
该程序提示用户输入任何整数,找到输入数的阶乘,并在屏幕上显示输出。我们将使用用户定义的递归函数来执行任务。这里我们有一个函数`find_factorial`,它以递归的方式调用自己,来找出输入数的阶乘。我们在下面的程序中涉及用户交互,但是如果你不想要那个部分,那么你可以简单地为变量`num`赋一个整数值并忽略`scanf`语句。简而言之,您可以以任何您想要的方式调整它,每种情况的逻辑都是相同的。
该程序提示用户输入任何整数,查找输入数的阶乘,并在屏幕上显示输出。我们将使用用户定义的递归函数来执行任务。这里我们有一个函数`find_factorial`,它以递归的方式调用自己,来找出输入数的阶乘。我们在下面的程序中涉及用户交互,但是如果你不想要那个部分,那么你可以简单地为变量`num`赋一个整数值并忽略`scanf`语句。简而言之,您可以以任何您想要的方式调整它,每种情况的逻辑都是相同的。
### 找到阶乘的程序
### 查找阶乘的程序
```c
 /* Program Name: Find Factorial
......
......@@ -2,7 +2,7 @@
> 原文: [https://beginnersbook.com/2014/06/c-program-to-find-prime-numbers-in-a-given-range/](https://beginnersbook.com/2014/06/c-program-to-find-prime-numbers-in-a-given-range/)
在执行以下程序时,将要求用户提供范围,然后程序将按顺序显示所提供范围的所有素数。使用此程序,您可以找到介于 1 到 100,100 到 999 等范围内的素数。您只需要输入范围,例如,如果您希望素数从 100 到 999,则在程序提示输入时输入数字 100 和 999。
在执行以下程序时,将要求用户提供范围,然后程序将按顺序显示所提供范围的所有素数。使用此程序,您可以查找介于 1 到 100,100 到 999 等范围内的素数。您只需要输入范围,例如,如果您希望素数从 100 到 999,则在程序提示输入时输入数字 100 和 999。
### 寻找素数的程序
......
......@@ -2,7 +2,7 @@
+ [C 语言中的 Hello World 程序](3.md)
+ [C 程序检查给定的整数是正还是负](4.md)
+ [C 程序使用递归函数反转给定的数字](5.md)
+ [C 程序找到最多的三个数字](6.md)
+ [C 程序查找最多的三个数字](6.md)
+ [C 显示 Fibonacci 系列的程序](7.md)
+ [C 使用递归查找数字因子的程序](8.md)
+ [C 程序查找给定范围内的素数](9.md)
......@@ -11,10 +11,10 @@
+ [C 程序查找给定范围内的回文数](12.md)
+ [C 程序检查数字是偶数还是奇数](13.md)
+ [C 程序查找字符的 ASCII 值](14.md)
+ [C 程序找到 int,float,double 和 char 的大小](15.md)
+ [C 程序查找 int,float,double 和 char 的大小](15.md)
+ [C 程序检查字母是元音还是辅音](16.md)
+ [C 计划检查闰年](17.md)
+ [C 程序找到前 n 个自然数的和](18.md)
+ [C 程序查找前 n 个自然数的和](18.md)
+ [字符串程序](19.md)
+ [C 程序将大写字符串转换为小写字符串](20.md)
+ [C 将小写字符串转换为大写字符串的程序](21.md)
......@@ -42,8 +42,8 @@
+ [C 程序计算并打印 nPr 的值](43.md)
+ [C 程序计算并打印 nCr 的值](44.md)
+ [C 程序乘以两个浮点数](45.md)
+ [C 程序找到商和剩余](46.md)
+ [C 程序找到两个数字的平均值](47.md)
+ [C 程序查找商和剩余](46.md)
+ [C 程序查找两个数字的平均值](47.md)
+ [数字系统转换程序](48.md)
+ [C 程序将二进制数转换为十进制数](49.md)
+ [C 程序将十进制数转换为二进制数](50.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册