2022年6月1日笔记
求阶乘
输入一个数n,求n的阶乘;
程序源码:
#include <stdio.h>
main(){
int i=1,result=1,n;
scanf("%d",&n);
for(i=1;i<=n;i++){ result *="i;" } printf("%d",result); < code></=n;i++){></stdio.h>
运行结果:
5
120
程序截图
a b 数值交换
程序源码:
#include<stdio.h>
main()
{
int a,b,c;
a=10;b=20;
c=a;
a=b;
b=c;
printf("%d %d",a,b);
}
</stdio.h>
执行结果:
20 10
程序截图
判断分数
程序源码:
#include <stdio.h>
main()
{
int num;
scanf("%d",&num);
if(num>=60){
printf("通过\n");
if(num>=90) printf("优秀");
}else {
printf("不通过");
}
}
</stdio.h>
执行结果:
输入:90
输出:
通过
优秀
程序截图
Original: https://www.cnblogs.com/hmi1234/p/16339517.html
Author: Hmi1234
Title: 2022年6月1日笔记
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/594608/
转载文章受原作者版权保护。转载请注明原作者出处!