Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
499 B

  1. #include <stdio.h>
  2. int main (void) {
  3. float cups;
  4. printf("Give a volume in cups: ");
  5. scanf("%f", &cups);
  6. float pints = cups / 2;
  7. float ounces = cups * 8;
  8. float tablespoons = ounces * 2;
  9. float teaspoons = tablespoons * 3;
  10. printf("The given volume are %0.2f pints\n", pints);
  11. printf("The given volume are %0.2f ounces\n", ounces);
  12. printf("The given volume are %0.2f tablespoons\n", tablespoons);
  13. printf("The given volume are %0.2f teaspoons\n", teaspoons);
  14. return 0;
  15. }