当前位置:网站首页>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.
边栏推荐
- MySQL optimistic lock and pessimistic lock
- thymeleaf中如何给onclick事件传值的方法
- Developer, you may have some misunderstandings about cloud computing
- Go language JSON processing
- High performance computing center RDMA implementation technology
- 大作业合集
- 谷贱伤农,薪贱伤码农!
- Successful experience of postgraduate entrance examination in materials and Chemical Engineering (metal) of Beijing University of Aeronautics and Astronautics in 2023
- Comic | code review is driving me crazy!
- Simple understanding of quick sort
猜你喜欢

Build a QQ robot to wake up your girlfriend

CVPR大会现场纪念孙剑博士,最佳学生论文授予同济阿里,李飞飞获黄煦涛纪念奖...

Too helpless! Microsoft stopped selling AI emotion recognition and other technologies, saying frankly: "the law can not keep up with the development of AI"

个人博客系统毕业设计开题报告

AI芯片技术-2022年

Lying trough, the most amazing paper artifact!

J. Med. Chem. | Release: a new drug design model for deep learning based on target structure

laravel8 beanstalk 使用说明

Is IPv6 faster than IPv4?

File IO (1)
随机推荐
陆奇首次出手投资量子计算
Confessing with Snake games (with source code)
基於STM32設計的寵物投喂器
Distributed common interview questions
Pycharm installation tutorial, super detailed
The second Tencent light · public welfare innovation challenge was launched, and the three competition topics focused on the social value of sustainable development
regular expression
Set up a QQ robot for ordering songs, and watch beautiful women
个人博客系统毕业设计开题报告
大作业合集
Bugs encountered in Oracle
[software and system security] heap overflow
谷贱伤农,薪贱伤码农!
CVPR大会现场纪念孙剑博士,最佳学生论文授予同济阿里,李飞飞获黄煦涛纪念奖...
2021-05-07封装 继承 super this
2021-05-11 abstract class
Different methods of PivotTable in SQL tutorial
File IO (1)
R和RStudio下载安装详细步骤
EasyCVR使用RTMP推流时不显示界面如何解决?