当前位置:网站首页>[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)
2022-07-02 02:16:00 【Try to be beautiful】
practice 1

#include<stdio.h>
int main(){
int year,month,day;
scanf("%d-%d-%d",&month,&day,&year);
printf("%d-%02d-%02d",year,month,day);
return 0;
}
practice 2

#include <stdio.h>
int main()
{
double x,y;
scanf("%lf",&x);
if(x<=15){y=4.0*x/3.0;}
else{y=2.5*x-10.5;}
printf("f(%.2f) = %.2f",x,y);
return 0;
}
3
#include <stdio.h>
#include<math.h>
int main()
{
// Input gives two positive integers in sequence in one line money、year And a positive real number rate, Space off
int money,year;
double sum,rate;
scanf("%d %d %lf",&money,&year,&rate);
//pow(1+rate,year) intend 1+rate Of year Word power
sum=money*pow(1+rate,year);
printf("sum = %0.2f",sum);
return 0;
}
title

边栏推荐
- SQLite 3 of embedded database
- leetcode2311. 小于等于 K 的最长二进制子序列(中等,周赛)
- 2022 Q2 - 提昇技能的技巧總結
- Spend a week painstakingly sorting out the interview questions and answers of high-frequency software testing / automated testing
- 【C#】使用正则校验内容
- Construction and maintenance of business websites [12]
- leetcode2310. 个位数字为 K 的整数之和(中等,周赛)
- Es interview questions
- how to add one row in the dataframe?
- Infix expression to suffix expression (computer) code
猜你喜欢

【读书笔记】程序员修炼手册—实战式学习最有效(项目驱动)

leetcode2309. The best English letters with both upper and lower case (simple, weekly)

Opencascade7.6 compilation

How to build and use redis environment

Golang lock

Query word weight, search word weight calculation
![[技术发展-21]:网络与通信技术的应用与发展快速概览-1- 互联网网络技术](/img/2d/299fa5c76416f74bd1a693c433dd09.png)
[技术发展-21]:网络与通信技术的应用与发展快速概览-1- 互联网网络技术

Vsocde has cli every time it is opened js

leetcode2305. 公平分发饼干(中等,周赛,状压dp)

MySQL中一条SQL是怎么执行的
随机推荐
leetcode2312. Selling wood blocks (difficult, weekly race)
【毕业季】研究生学长分享怎样让本科更有意义
es面試題
2022 Q2 - 提昇技能的技巧總結
MySQL如何解决delete大量数据后空间不释放的问题
Five skills of adding audio codec to embedded system
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
How to build and use redis environment
Kibana controls es
leetcode2312. 卖木头块(困难,周赛)
MySQL view concept, create view, view, modify view, delete view
1222. Password dropping (interval DP, bracket matching)
Calculation (computer) code of suffix expression
Email picture attachment
剑指 Offer 29. 顺时针打印矩阵
Software No.1
Construction and maintenance of business websites [11]
Architecture evolution from MVC to DDD
Logging only errors to the console Set system property ‘log4j2. debug‘ to sh
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强