当前位置:网站首页>[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
边栏推荐
- MySQL operates the database through the CMD command line, and the image cannot be found during the real machine debugging of fluent
- How to hide the scroll bar of scroll view in uniapp
- Exception handling of class C in yyds dry goods inventory
- Regular expression learning notes
- trading
- flutter 中間一個元素,最右邊一個元素
- leetcode2311. 小于等于 K 的最长二进制子序列(中等,周赛)
- LFM signal denoising, time-frequency analysis, filtering
- Redis有序集合如何使用
- 【带你学c带你飞】2day 第8章 指针(练习8.1 密码开锁)
猜你喜欢
How to build and use redis environment
A quick understanding of digital electricity
大厂裁员潮不断,双非本科出身的我却逆风翻盘挺进阿里
Design and implementation of key value storage engine based on LSM tree
MySQL如何解决delete大量数据后空间不释放的问题
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
Software No.1
Summary of some experiences in the process of R & D platform splitting
MySQL主从延迟问题怎么解决
【带你学c带你飞】2day 第8章 指针(练习8.1 密码开锁)
随机推荐
Sword finger offer 31 Stack push in and pop-up sequence
Redis环境搭建和使用的方法
MySQL约束与多表查询实例分析
leetcode2312. Selling wood blocks (difficult, weekly race)
研发中台拆分过程的一些心得总结
Golang lock
Flutter un élément au milieu, l'élément le plus à droite
Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing
Architecture evolution from MVC to DDD
Email picture attachment
* and & symbols in C language
【liuyubobobo-玩转Leetcode算法面试】【00】课程概述
Which is a good Bluetooth headset of about 300? 2022 high cost performance Bluetooth headset inventory
An analysis of circuit for quick understanding
leetcode2309. The best English letters with both upper and lower case (simple, weekly)
CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
The middle element and the rightmost element of the shutter
Duplicate keys detected: ‘0‘. This may cause an update error. found in
MySQL如何解决delete大量数据后空间不释放的问题
How to turn off debug information in rtl8189fs