int main() {
while (1) {
float d;
scanf("%f", &d);
float x;
for (x = d; x <= d + 1000.0; x = x + 1000.0) {
}
printf("loop exited with x = %.14g\n", x);
}
return 0;
}
If you run the program, you will see. What number should I use as an input to make this an infinite loop?
Answer:
We will use a string or character instead of float or integer. Since d is declared as float and when we will give a string or character as a input and it will make an error in the program that will take the for loop in the program into infinte loop.
Get Answers For Free
Most questions answered within 1 hours.