什么是这个code中的百分比字符的含义是什么? [英] What is the meaning of the percent character in this code?

查看:128
本文介绍了什么是这个code中的百分比字符的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这种情况下,什么是百分比指的是?

In this case, what does the percentage refers to?

int myInt = 27 % 10;  
myInt = 7;  

什么的在这个code是什么意思?

What does the % mean in this code?

推荐答案

%意味着剩下的,当27除以10离开余7

% means remainder, when 27 is divided by 10 leaves a remainder 7

EDIT: 

我的2美分所有约模和放大器之间的差别的讨论;其余

My 2 cents about all the discussion about difference between modulo & remainder

乘坐%B

1. When both +ve, Modulo & Remainder are one and the same
2. When a is -ve, they are not the same

例如;

A = 10,B = 3

a = -10, b = 3

-10%,剩余3 = -1

Remainder of -10 % 3 = -1

用于模,3更大倍数添加到您的'a'和计算的余数。

for Modulo, add a greater multiple of 3 to your 'a' and calculate the remainder.

-10 + 12 = 2

-10 + 12 = 2

2%3 = 2是你的答案

2 % 3 = 2 is your answer

这篇关于什么是这个code中的百分比字符的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆