DEV Community

Discussion on: How to make a calculator using c programming?

Collapse
 
swapnil7000 profile image
Swapnil7000

Thnx for suggesting. Are you saying that it should give infinity on dividing with zero?

Collapse
 
bjauny profile image
Bastien JAUNY

That's entirely up to you. You can make it so it refuses the operands and displays an error or you can make it return infinity.
In any case, with the current code, the behavior when dividing by 0 is not what you can expect.

Thread Thread
 
swapnil7000 profile image
Swapnil7000 • Edited

Actually on dividing by zero it is giving infinity as an output check it on compiler version gcc 6.3.0