My result is listed as:
"You will need 0.00 yards of light, 0.00 yards of medium, and 0.00 yards of dark fabric for your quilt."
No matter the values entered, answers are always 0.00. What am I doing wrong?
Hope this is straight-forward.Code:/* Quilting Fabric Calculator */ #include <stdio.h> #include <stdlib.h> int main() { int light, medium, dark; float yards, light_f, medium_f, dark_f; printf("Percent of quilt that will consist of light fabrics: "); scanf("%d", &light); printf("\nPercent of quilt that will consist of medium fabrics: "); scanf("%d", &medium); printf("\nPercent of quilt that will consist of dark fabrics (all should total 100): "); scanf("%d", &dark); printf("\nEnter yards of fabric: "); scanf("%f", &yards); light_f = (float) yards * (light / 100); medium_f = (float) yards * (medium / 100); dark_f = (float) yards * (dark / 100); printf("\n\nYou will need %.2f yards of light, %.2f yards of medium, and %.2f yards of dark fabric for your quilt.\n\n", light_f, medium_f, dark_f); printf("\nPress Enter to continue...\n"); getchar(); return 0; }
Thanks!
Chris



LinkBack URL
About LinkBacks


