Question: How do I check for a null operator to stop the floating point exception when trying to divide by the last number of the array(0)?

How do I check for a null operator to stop the floating point exception when trying to divide by the last number of the array(0)?

#include

int main() { int out = 0, tot = 0, cnt = 0; int val[] = {5, 54, 76, 91, 35, 27, 45, 15, 99, 0};

while(cnt < 10) { out = val[cnt]; tot = tot + 0xffffffff/out; cnt++; }

printf(" Total = [%d] ", tot); return 0; }

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 Databases Questions!