Skip to content

Instantly share code, notes, and snippets.

@George-smart
Created October 11, 2022 21:47
Show Gist options
  • Save George-smart/da7586ba546cc0375c3cd1369cb2a1f3 to your computer and use it in GitHub Desktop.
Save George-smart/da7586ba546cc0375c3cd1369cb2a1f3 to your computer and use it in GitHub Desktop.
// Addition Function
int addition(int num1, int num2) {
return (num1 + num2);
}
// Subtraction Function
int subtraction(int num1, int num2) {
return (num1 - num2);
}
// Division function
double division(int num1, int num2) {
return (num1 / num2);
}
// Multiplication Function
int multiplication(int num1, int num2) {
return (num1 * num2);
}
// Modulus function
int modulus(int num1, int num2) {
return (num1 % num2);
}
void main() {
int num1 = 12;
int num2 = 3;
int result;
// call the functions
result = addition(num1, num2);
print(result);
result = subtraction(num1, num2);
print(result);
double total = division(num1, num2);
print(total);
result = modulus(num1, num2);
print(result);
result = multiplication(num1, num2);
print(result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment