当前位置:网站首页>Introduction to C language (7)
Introduction to C language (7)
2022-07-18 17:53:00 【InfoQ】
1. What quadrant is the judgment point
1 11#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a>0&&b>0)
printf("1");
if(a<0&&b>0)
printf("2");
if(a<0&&b<0)
printf("3");
if(a>0&&b<0)
printf("4");
return 0;
}2. Staff salaries
300002600.00#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
double m;
scanf("%d",&a);
if(a<=10000)
m=a*0.05+1500;
if(a>10000&&a<=50000)
m=(a-10000)*0.03+1500+500;
if(a>50000)
m=(a-50000)*0.02+1500+500+1200;
printf("%.2lf",m);
return 0;
}3. Five grade system
100
A#include <stdio.h>
#include <stdlib.h>
int main()
{
int m;
scanf("%d",&m);
if(m>=90)
printf("A");
if(m>79&&m<90)
printf("B");
if(m>69&&m<80)
printf("C");
if(m>59&&m<70)
printf("D");
if(m<60)
printf("E");
return 0;
}4. Summer sales
5100 4080.00#include <stdio.h>
#include <stdlib.h>
int main()
{
int m;
double n;
scanf("%d",&m);
if(m>=5000)
n=0.8*m;
if(m>=1000&&m<3000)
n=0.9*m;
if(m>=500&&m<1000)
n=0.95*m;
if(m<500)
n=m;
if(m>=3000&&m<5000)
n=0.85*m;
printf("%.2f",n);
return 0;
}5. Piecewise function evaluation
2-3#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int x,y;
scanf("%d",&x);
if(x<-2)
y=7-2*x;
if(x>=-2&&x<3)
y=5-fabs(3*x+2);
if(x>=3)
y=3*x+4;
printf("%d",y);
return 0;
}边栏推荐
- Outdoor LED display has a clever way to deal with hot weather
- 【排序】插入排序、希尔排序和堆排序
- 【AUTOSAR-DEM】-2.4-APP SWC如何读取MIL灯状态以及配置MIL灯
- An excellent graphical tool for information collection maltego
- leetCode-5 最长回文子串
- 文件解析漏洞详解
- 天逸BEYOND中改预售15.77万起售 毛创新:产品力绝对在第一阵营
- balanced binary tree
- STC8H开发(十四): I2C驱动RX8025T高精度实时时钟芯片
- The 100 billion yuan universe market is the new driving force of soul and Yingke
猜你喜欢

SAP Fiori Launchpad 上看不到任何 tile 应该怎么办?

网络原理之TCP/IP协议

爱立信以侵权为由要求禁售,苹果回返美国反诉,这一幕如此熟悉
![[CVA valuation training camp] how to quickly read the annual reports of listed companies (Lecture 1)](/img/a7/32754c1cded580d739fac44d5eb5cb.png)
[CVA valuation training camp] how to quickly read the annual reports of listed companies (Lecture 1)

如何解决8080端口被占用

作用域、构造器详解

天逸BEYOND中改预售15.77万起售 毛创新:产品力绝对在第一阵营

HCIA-R&S自用笔记(6)(网络层)ICMP、IP协议基础及分片

How to reinstall win10? One click reinstallation of graphic version of win10 tutorial

uniapp微信小程序 选择聊天记录文件上传
随机推荐
Penetration test tool - MSF generates backdoor immunity
W806 development board driver ov2640 reads JPEG pictures 1600x1200 resolution
Detailed explanation of file parsing vulnerability
关于cJSON的valueint超过整型范围的问题
27-Scala入门、基本数据类型和方法与函数的介绍
欢迎来到 GrafanaFans 兴趣小组
Find prime number
SWD/JTAG Communication Failure和No Target Connected
千亿元宇宙市场,Soul、映客的新动力
V831 - apriltag tag identification
PostgreSQL source code (8) xlog initialization
Which vite plug-ins can quickly provide development efficiency
Tips for copying content in web pages without login account
今日睡眠质量记录85分
MFC | self drawing of buttons under the frame
balanced binary tree
HCIA-R&S自用笔记(10)VRP基础、命令、远程管理
[动态规划]DP19 最长公共子序列(一)-中等
【UVM】AXI VIP 采用寄存器模型访问寄存器,ID 被固定为 0 的问题
【论文笔记】—目标检测—YOLOv1—2016-CVPR