当前位置:网站首页>C语言:逻辑运算和判断选择结构例题
C语言:逻辑运算和判断选择结构例题
2022-07-02 03:43:00 【念迟鱼学编程】
#include <stdio.h>
int main()
{
int x , m , n;
int sum = 0;
printf("请输入一个数(1-10000)");
scanf("%d",&x);
switch(x%2){
case 0:{
printf("请输入两个整数:");
scanf("%d%d",&m,&n);
sum = m+n;
printf("%d和%d的和为:%d\n",m,n,sum);
break;
}
default:{
printf("请输入两个整数:");
scanf("%d%d",&m,&n);
sum = m-n;
printf("%d和%d的和为:%d\n",m,n,sum);
break;
}
}
return 0;
}
边栏推荐
- 蓝桥杯单片机省赛第九届
- 【无线图传】基于FPGA的简易无线图像传输系统verilog开发,matlab辅助验证
- 微信小程序中 在xwml 中使用外部引入的 js进行判断计算
- [wireless image transmission] FPGA based simple wireless image transmission system Verilog development, matlab assisted verification
- 软件测试人的第一个实战项目:web端(视频教程+文档+用例库)
- regular expression
- 【DesignMode】原型模式(prototype pattern)
- Kotlin 基础学习13
- 蓝桥杯单片机省赛第十一届第一场
- < job search> process and signal
猜你喜欢
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有
集成底座方案演示说明
Pycharm2021 delete the package warehouse list you added
蓝桥杯单片机省赛第十二届第二场
[mv-3d] - multi view 3D target detection network
u本位合约爆仓清算解决方案建议
蓝桥杯单片机省赛第六届
The 8th Blue Bridge Cup single chip microcomputer provincial competition
高性能 低功耗Cortex-A53核心板 | i.MX8M Mini
Suggestions on settlement solution of u standard contract position explosion
随机推荐
Kotlin基础学习 14
Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
5G时代全面到来,浅谈移动通信的前世今生
How to do medium and long-term stocks, and what are the medium and long-term stock trading skills?
Vite: configure IP access
Suggestions on settlement solution of u standard contract position explosion
PY3, PIP appears when installing the library, warning: ignoring invalid distribution -ip
What do you know about stock selling skills and principles
What kind of interview is more effective?
This article describes the step-by-step process of starting the NFT platform project
Pycharm2021 delete the package warehouse list you added
Failed to upgrade schema, error: “file does not exist
[ibdfe] matlab simulation of frequency domain equalization based on ibdfe
VS2010插件NuGet
集成底座方案演示说明
【无线图传】基于FPGA的简易无线图像传输系统verilog开发,matlab辅助验证
Blue Bridge Cup single chip microcomputer sixth temperature recorder
How about Ping An lifetime cancer insurance?
ThreadLocal详解
"Analysis of 43 cases of MATLAB neural network": Chapter 42 parallel operation and neural network - parallel neural network operation based on cpu/gpu