My assignment is to write a program that reads a list of dry measures in pints until end-of-file and then converts each measure into quarts and pecks.
Here is my code so far:
Code:
#include <stdio.h>
main()
{
int pint, peck, quart;
printf(" Enter next amount: ");
scanf( "%d", &pint );
while ( peck >= 0 ) {
peck = 0.0537104354 * pint;
quart = .5 * pint;
printf( "\n%d pints =\n", pint );
printf( "%d pecks\n", peck );
printf( "%d quarts\n", quart );
printf( " Enter next amount: " );
scanf( "%d", &pint );
}
printf( "*** END OF PROGRAM ***\n" );
}
It is not converting at all. All it does is prompt the user to enter an amount, and after that it just says *** END OF PROGRAM ***. At one point it was converting, but the numbers weren't right. I changed some things and now it barely does anything. I don't know what's going on?