fix: modulo by zero
This commit is contained in:
@@ -20,10 +20,10 @@ int main() {
|
|||||||
multiplication = first * second;
|
multiplication = first * second;
|
||||||
if (second != 0) {
|
if (second != 0) {
|
||||||
division = first / second;
|
division = first / second;
|
||||||
|
modulo = first % second;
|
||||||
} else {
|
} else {
|
||||||
printf("\n\nError: Dividing by 0 is not allowed. Output will be 0.\n\n");
|
printf("\nError: Dividing by 0 is not allowed. Output will be 0 for devision and modulo.\n\n");
|
||||||
}
|
}
|
||||||
modulo = first % second;
|
|
||||||
|
|
||||||
// output of calculation
|
// output of calculation
|
||||||
printf("The results are:\n+ = %i\n- = %i\n* = %i\n/ = %f\nmod = %i", addition, subtraction, multiplication, division, modulo);
|
printf("The results are:\n+ = %i\n- = %i\n* = %i\n/ = %f\nmod = %i", addition, subtraction, multiplication, division, modulo);
|
||||||
|
|||||||
Reference in New Issue
Block a user