Question: c program 1) Replace the while loop with a do...while loop. The new code should work exactly the same way as the old, i.e. it
1) Replace the while loop with a do...while loop. The new code should work exactly the same way as the old, i.e. it should compute distance and print out the values of time and distance only if time entered is a non-negative number (including if a value /* Note: this line should appear if we use scanf() and printf() function * maino { int distance, rate, time; rate=14; printf("Enter next time:" ); scanf("%d", &time); /* Note: %d denotes integer, ampersand (&) is required before cach (non pointer) variable in scanf/ while time >0){ distance = rate * time; printf("Time =%d hours ", time); printf("Distance =%d kilometers ", distance); printf("Enter next time:" ); scanf("%d", &time); 3 printf( **** End of Program *** "); file name distance.c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
