当前位置:网站首页>NOI OJ 1.3 11:计算浮点数相除的余数 C语言
NOI OJ 1.3 11:计算浮点数相除的余数 C语言
2022-06-23 10:12:00 【chd44】
描述
计算两个双精度浮点数a和b的相除的余数,a和b都是正数的。这里余数(r)的定义是:a = k * b + r,其中 k是整数, 0 <= r < b。
输入
输入仅一行,包括两个双精度浮点数a和b。
输出
输出也仅一行,a÷b的余数
#include<stdio.h>
int main(){
double a,b,r;
int k;
scanf("%lf %lf",&a,&b);
k=a/b;
r=a-k*b;
printf("%g",r);
return 0;
}注:看清楚题目,明确余数的求法。
使用printf("%g",x),能使输出时小数部位没有多余的0.
边栏推荐
- IPv6 的速度比 IPv4 更快?
- 个人博客系统毕业设计开题报告
- Alimentation des animaux de compagnie basée sur stm32
- 开发者,你对云计算可能有些误解
- 谷贱伤农,薪贱伤码农!
- laravel8 beanstalk 使用说明
- Tencent tangdaosheng: practice "science and technology for the good" and promote sustainable social value innovation
- Mathematical analysis_ Notes_ Chapter 2: real and plural numbers
- Liujinhai, architect of zhongang Mining: lithium battery opens up a Xintiandi for fluorine chemical industry
- Successful experience in postgraduate entrance examination for MTI master of English translation major of Beijing University of science and technology in 2023
猜你喜欢

汇编语言中断及外部设备操作篇--06

JVM简单入门-01

Build the information and innovation industry ecology, and make mobile cloud based on the whole stack of independent innovation

2021-05-07构造器
![[software and system security] heap overflow](/img/ca/1b98bcdf006f90cabf3e90e416f7f2.png)
[software and system security] heap overflow

sql根据比较日期新建字段

SQL create a new field based on the comparison date

IPv6 的速度比 IPv4 更快?

Several practical software sharing

STM32F1与STM32CubeIDE编程实例-红外寻迹传感器驱动
随机推荐
高性能算力中心 — NVMe/NVMe-oF — NVMe-oF Overview
mysql innodb 的 redo log buffer 中未 commit 的事务持久化到 redo log 后,万一事务 rollback 了怎么办?redo log 怎么处理这个事务操作?
Year end answer sheet! Tencent cloud intelligent comprehensive strength ranks first in China!
Data structures and differences between MySQL InnoDB engine and MyISAM
用贪吃蛇小游戏表白(附源码)
Successful experience in postgraduate entrance examination for MTI master of English translation major of Beijing University of science and technology in 2023
春招面试经验汇总(技术岗)
AI system frontier dynamics issue 38: Google has abandoned tensorflow?; Four GPU parallel strategies for training large models; Father of llvm: modular design determines AI future
The era of copilot free is over! The official version is 67 yuan / month, and the student party and the defenders of popular open source projects can prostitute for nothing
MySQL-01.工作中数据库优化和explain字段知识的总结
Multithreaded exercises
在OpenCloudOS使用snap安装.NET 6
线程池在项目中使用的心得体会
Unity技术手册 - 生命周期内速度限制(Limit Velocity Over Lifetime)子模块和速度继承(Inherit Velocity)子模块
High performance computing center RDMA implementation technology
Spring recruitment interview experience summary (technical post)
thymeleaf中如何给onclick事件传值的方法
The second Tencent light · public welfare innovation challenge was launched, and the three competition topics focused on the social value of sustainable development
Unable to enter the system normally, press F8 to select other items to try to enter
搭建一个点歌QQ机器人,另外还能看美女