Question: How do I refactor my code (in a function) to replace the following nested if-else statements to a do-while loop in C code: int funciton()

How do I refactor my code (in a function) to replace the following nested if-else statements to a do-while loop in C code:

int funciton() { int x; printf("... "); scanf("%d%*c", &x);

if (x < 0) { printf("..."); exit(0);

} else if ((x < 1) || (x > 100)) {

printf("...");

function();

} else {

return x;

}

}

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!