Question: I wrote a program in C which crashed when it was run. The following text was copied and pasted directly from a shell window: Program

I wrote a program in C which crashed when it was run. The following text was copied and pasted directly from a shell window:
Program received signal SIGFPE, Arithmetic exception.
0x000000000040114f in zero_int (yr1=2010, yr2=2010, amt=100000)
at mortgage.c:11
11 return amt /(yr2- yr1);
(gdb) list
6 #include
7 #include
8
9 double zero_int(int yr1, int yr2, int amt)
10{
11 return amt /(yr2- yr1);
12}
13
14
15/* the mortgage formula is from page 202 of
(gdb)
a. What is the most likely reason the program stopped?
b. What did the user (person running the program) most likely do wrong? How do you know?
c. How should the program be changed to prevent this from happening again?|
I wrote a program in C which crashed when it was

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!