C
C_beginner
Am I did the following program corectly according to the question?
Question:
/* 1:You have just been employed by MacroMuscle, Inc.
(Software for Hard Bodies). The company is entering the European
market and wants a program that converts inches to
centimeters (1 inch = 2.54 cm). The company wants the
program set up so that it prompts the user to enter an inch
value. Your assignment is to define the program objectives and
to design the program (steps 1 and 2 of the programming process).
*/
solution:
#include<stdio.h>
#define centmeter 2.54
int main(void)
{
int inches_to_input;
float inches_to_output;
printf("please enter a inches\n");
scanf("%d",&inches_to_input);
inches_to_output = inches_to_input * centmeter;
printf("inches converted is %f\n",inches_to_output);
return 0;
}
Question:
/* 1:You have just been employed by MacroMuscle, Inc.
(Software for Hard Bodies). The company is entering the European
market and wants a program that converts inches to
centimeters (1 inch = 2.54 cm). The company wants the
program set up so that it prompts the user to enter an inch
value. Your assignment is to define the program objectives and
to design the program (steps 1 and 2 of the programming process).
*/
solution:
#include<stdio.h>
#define centmeter 2.54
int main(void)
{
int inches_to_input;
float inches_to_output;
printf("please enter a inches\n");
scanf("%d",&inches_to_input);
inches_to_output = inches_to_input * centmeter;
printf("inches converted is %f\n",inches_to_output);
return 0;
}