*

名称

*

説明

乗算は四則演算の一つである。演算子*(アスタリスク)は、二つのオペランドの積を計算する。

書式

product = operand1 * operand2;

引数

product変数。利用できるデータ型: int, float, double, byte, short, long。
operand1変数か定数。利用できるデータ型: int, float, double, byte, short, long。
operand2変数か定数。利用できるデータ型: int, float, double, byte, short, long。

使用例

1
2
3
4
int a = 5;
int b = 10;
int c = 0;
c = a * b;  // the variable 'c' gets a value of 50 after this statement is executed

注意

  1. 剰余演算子は浮動小数点数に対しては動作しない。
  2. 一番目の引数が負の場合は、結果は負もしくは0である。このため、x * 10の結果は、xが負の場合も考えられるので、必ず0から9の間というわけではない。

参照

オリジナルのページ

https://www.arduino.cc/reference/en/language/structure/arithmetic-operators/remainder/

Last Revision: 2019/02/19

最終更新日

January 4, 2024

inserted by FC2 system