当前位置:网站首页>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;
}
边栏推荐
- Kotlin 基础学习13
- [untitled] basic operation of raspberry pie (2)
- Basic syntax of unity script (8) - collaborative program and destruction method
- [database]jdbc
- [mv-3d] - multi view 3D target detection network
- Failed to upgrade schema, error: “file does not exist
- Introduction to Robotics II. Forward kinematics, MDH method
- Oracle的md5
- [tips] use Matlab GUI to read files in dialog mode
- 潘多拉 IOT 开发板学习(RT-Thread)—— 实验1 LED 闪烁实验(学习笔记)
猜你喜欢

Basic syntax of unity script (6) - specific folder

The first practical project of software tester: web side (video tutorial + document + use case library)

0基础如何学习自动化测试?按照这7步一步一步来学习就成功了

焱融看 | 混合云时代下,如何制定多云策略

ThreadLocal详解

近段时间天气暴热,所以采集北上广深去年天气数据,制作可视化图看下

The 7th Blue Bridge Cup single chip microcomputer provincial competition

The 10th Blue Bridge Cup single chip microcomputer provincial competition

In wechat applet, the externally introduced JS is used in xwml for judgment and calculation

Set vscode. When double clicking, the selected string includes the $symbol - convenient for PHP operation
随机推荐
How to do medium and long-term stocks, and what are the medium and long-term stock trading skills?
"Analysis of 43 cases of MATLAB neural network": Chapter 41 implementation of customized neural network -- personalized modeling and Simulation of neural network
The second game of the 12th provincial single chip microcomputer competition of the Blue Bridge Cup
蓝桥杯单片机省赛第六届
Kotlin basic learning 13
Qt的网络连接方式
How about Ping An lifetime cancer insurance?
焱融看 | 混合雲時代下,如何制定多雲策略
Jetpack之LiveData扩展MediatorLiveData
蓝桥杯单片机第四届省赛
接口调试工具模拟Post上传文件——ApiPost
Haute performance et faible puissance Cortex - A53 Core Board | i.mx8m mini
MD5 of Oracle
In the era of programmers' introspection, five-year-old programmers are afraid to go out for interviews
《MATLAB 神經網絡43個案例分析》:第42章 並行運算與神經網絡——基於CPU/GPU的並行神經網絡運算
JS generate random numbers
焱融看 | 混合云时代下,如何制定多云策略
Oracle 查看被锁的表和解锁
[personal notes] PHP common functions - custom functions
How to establish its own NFT market platform in 2022