Created
February 23, 2020 12:26
-
-
Save techzeero/46926db68ea9e689fdbd06a03c7a04c0 to your computer and use it in GitHub Desktop.
Arduino Arithmetic Operators | https://techzeero.com/arduino-tutorials/arduino-arithmetic-operators/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Arduino Arithmetic Operators | |
For more details, visit: https://techzeero.com/arduino-tutorials/arduino-arithmetic-operators/ | |
*/ | |
void setup() { | |
int a = 2; | |
int b = 3; | |
int result; | |
float result_fl; | |
Serial.begin(9600); | |
Serial.print("Addition of (a + b): "); | |
result = a + b; | |
Serial.println(result); | |
Serial.print("Subtraction (5 - 3): "); | |
result = 5 - 3; | |
Serial.println(result); | |
Serial.print("Multiplication (6 * 3): "); | |
result = 6 * 3; | |
Serial.println(result); | |
Serial.print("Int Division (3 / 2): "); | |
result = 3 / 2; | |
Serial.println(result); | |
Serial.print("Float Division (3.0 / 2.0): "); | |
result_fl = 3.0 / 2.0; | |
Serial.println(result_fl); | |
Serial.print("Remainder (10 % 4): "); | |
result = 10 % 4; | |
Serial.println(result); | |
Serial.print("2 Power of 3: "); | |
result = pow(3,2); | |
Serial.println(result); | |
Serial.print("Square Root of 5: "); | |
Serial.println(sqrt(5)); | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment