Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For my code, I want the result of any number divided by 0 to be ERROR: Cannot Divide By 0. But whenever I run it

image text in transcribed

image text in transcribed

For my code, I want the result of any number divided by 0 to be "ERROR: Cannot Divide By 0". But whenever I run it I get "Floating point exception (core dumped)". Is there any way I can change this?

int main (void) int num1; int num2; int sum int difference int product; int quotient; char operator; printf("Enter integer +I scanf("%d %c %d", &num1, I*/ integer: "); &operator, &num2); quotientnuml / num2; sumnuml num2; difference- numl - num2; productnuml *num2; if (operator+') printf("%d + %d %d", num1, num2, sum); else if (operator') printf("%d %d- %d", num1, num2, difference) ; ) %d-%d", else if (operator' printf("%d num1, num2 , product); * else if (operator:- '/') { if (num20) printf("%d / %d Error: Cannot divide by ", num1, num2); y else t printf("%d / %d-%d", num1, num2 , quotient); return ; Enter integer +-* |/ integer 7/0 Floating point exception (core dumped)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions

Question

Have I incorporated my research into my outline effectively?

Answered: 1 week ago