当前位置:网站首页>[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

边栏推荐
- LFM signal denoising, time-frequency analysis, filtering
- Medical management system (C language course for freshmen)
- Calculation (computer) code of suffix expression
- leetcode373. Find and minimum k-pair numbers (medium)
- Webgpu (I): basic concepts
- CSDN insertion directory in 1 second
- 734. Energy stone (greed, backpack)
- essay structure
- 321. Chessboard segmentation (2D interval DP)
- Logging only errors to the console Set system property ‘log4j2. debug‘ to sh
猜你喜欢

How to batch add background and transition effects to videos?

Summary of some experiences in the process of R & D platform splitting

How to build and use redis environment

Five skills of adding audio codec to embedded system

【带你学c带你飞】1day 第2章 (练习2.2 求华氏温度 100°F 对应的摄氏温度

Ar Augmented Reality applicable scenarios
![[技术发展-21]:网络与通信技术的应用与发展快速概览-1- 互联网网络技术](/img/2d/299fa5c76416f74bd1a693c433dd09.png)
[技术发展-21]:网络与通信技术的应用与发展快速概览-1- 互联网网络技术

321. Chessboard segmentation (2D interval DP)

1069. Division of convex polygons (thinking, interval DP)

Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing
随机推荐
2022 Q2 - Summary of skills to improve skills
Selection of field types for creating tables in MySQL database
JS slow animation
How to execute an SQL in MySQL
[question] - why is optical flow not good for static scenes
MySQL如何解决delete大量数据后空间不释放的问题
Open那啥的搭建文档
Construction and maintenance of business websites [15]
RTL8189FS如何关闭Debug信息
LFM signal denoising, time-frequency analysis, filtering
Comparative analysis of MVC, MVP and MVVM, source code analysis
leetcode2305. Fair distribution of biscuits (medium, weekly, shaped pressure DP)
A quick understanding of analog electricity
MySQL view concept, create view, view, modify view, delete view
Summary of some experiences in the process of R & D platform splitting
大厂裁员潮不断,双非本科出身的我却逆风翻盘挺进阿里
How to turn off debug information in rtl8189fs
Cesium dynamic diffusion point effect
leetcode2305. 公平分发饼干(中等,周赛,状压dp)
[C #] use regular verification content