目录:
代码演示
运行结果
乘法口诀是中国古代筹算中进行乘法、除法、开方等运算的基本计算规则,沿用至今已有两千多年。又称九九表、九九歌、九因歌、九九乘法表。
乘法表代码演示:
//乘法口诀表
#include<stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
int a, b, result;
for (a=1;a<=9;a++)
{
for(b=1;b<=a;b++)
{
result = a*b;
printf("%d*%d=%d ", a, b, result);
}
printf("\n");
}
system("pause");
return 0;
}
运行结果:
求10个数字中最大值代码演示:
#include<stdio.h>
#include<stdlib.h>
int main(){
int arr[10] = { 3, 12, 7, 8, 5, 6, 1, 2, 19, 0 };
int len = sizeof(arr) / sizeof(arr[0]);
int m, i, max;
printf("求出该数列里最大值:");
for (m = 0; m < len; m++){
printf("%d ", arr[m]);
}
printf("\n");
max = arr[0];
for (i = 0; i < len; i++){
if (max< arr[i]){
max = arr[i];
}
}
printf("max=%d\n", max);
system("pause");
return 0;
}
运行结果: