| Description
This example prompts
the user to enter the feet and then
converts this to metres and centimtres
.
Code
#include <stdio.h>
int main()
{
float feet,metres,centimetres;
printf("Enter the amount of feet
you wish to convert.\n");
scanf("%f",&feet);
while(feet > 0)
{
centimetres = feet * 12 * 2.54;
metres = centimetres / 100;
printf("%6.2f feet is equal to
\n",feet);
printf("%6.2f metres\n",metres);
printf("%8.2f centimetres\n",centimetres);
printf("Enter another value to
be converted or \n");
printf("enter 0 to exit.\n");
scanf("%f",&feet);
}
return 0;
}
Information
tested using LCC Win
32
|