当前位置:网站首页>[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
边栏推荐
- The wave of layoffs in big factories continues, but I, who was born in both non undergraduate schools, turned against the wind and entered Alibaba
- CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
- AR增强现实可应用的场景
- As a software testing engineer, will you choose the bank post? Laolao bank test post
- 大厂裁员潮不断,双非本科出身的我却逆风翻盘挺进阿里
- Redis有序集合如何使用
- JMeter (II) - install the custom thread groups plug-in
- Kibana操控ES
- Word search applet design report based on cloud development +ppt+ project source code + demonstration video
- Construction and maintenance of business websites [11]
猜你喜欢
OpenCASCADE7.6编译
pytest 测试框架
CSDN article underlined, font color changed, picture centered, 1 second to understand
Additional: information desensitization;
MySQL中一条SQL是怎么执行的
leetcode2305. Fair distribution of biscuits (medium, weekly, shaped pressure DP)
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
Software No.1
734. Energy stone (greed, backpack)
RTL8189FS如何关闭Debug信息
随机推荐
Deployment practice and problem solving of dash application development environment based on jupyter Lab
essay structure
Data analysis on the disaster of Titanic
Quality means doing it right when no one is looking
leetcode373. Find and minimum k-pair numbers (medium)
How to batch add background and transition effects to videos?
JMeter (II) - install the custom thread groups plug-in
MySQL view concept, create view, view, modify view, delete view
Sword finger offer 29 Print matrix clockwise
Opencascade7.6 compilation
flutter 中间一个元素,最右边一个元素
附加:信息脱敏;
Sword finger offer 42 Maximum sum of continuous subarrays
Opengauss database backup and recovery guide
golang---锁
mysql列转行函数指的是什么
How to build and use redis environment
Flutter un élément au milieu, l'élément le plus à droite
Summary of some experiences in the process of R & D platform splitting
Pat a-1165 block reversing (25 points)