求一个数的除法余数

编程入门 行业动态 更新时间:2024-10-08 10:55:40
本文介绍了求一个数的除法余数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我怎样才能在 Python 中找到一个数字的除法余数?

How could I go about finding the division remainder of a number in Python?

例如:如果数为26,被除数为7,则除法余数为5.(因为 7+7+7=21 和 26-21=5.)

For example: If the number is 26 and divided number is 7, then the division remainder is 5. (since 7+7+7=21 and 26-21=5.)

推荐答案

您正在寻找模运算符:

a % b

例如:

26 % 7

当然,也许他们希望你自己实现它,这也不会太难.

Of course, maybe they wanted you to implement it yourself, which wouldn't be too difficult either.

更多推荐

求一个数的除法余数

本文发布于:2023-11-29 09:07:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645957.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:余数   除法   个数

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!