You had your quotes on your scanf's in the wrong place. It needs to go:
scanf("format strings", variables);
like so:
scanf("%d", &bob);
Simple typo bug.
fixed code:
Quote:
#include <stdio.h>
main(void)
{
int nRoomLength=0, nRoomWidth=0, nRoomHeight=0;
double dWidthToLength=0 ; /* width/length */
short int nRoomVolume=0 ; /* nRoomWidth * nRoomLength * nRoomHeight*/
unsigned int nRoomArea=0 ; /* nRoomWidth * nRoomLength */
printf("Please enter a value for the room width:");
scanf("%d", &nRoomLength);
printf("Please enter a value for the room length::");
scanf("%d", &nRoomWidth);
printf("Please enter a value for the room height::");
scanf("%d", &nRoomHeight);
dWidthToLength = nRoomWidth / nRoomLength;
nRoomArea = nRoomLength * nRoomWidth;
nRoomVolume = nRoomLength * nRoomWidth * nRoomHeight;
printf("The area of the floor of the room is: %d", nRoomArea);
printf("The volume of the room is: %d", nRoomVolume);
printf("The ratio of the width to the length is: %d", dWidthToLength);
}
|
and it looks like you have a bug or two left.
bob:~ johnwort$ ./out
Please enter a value for the room width:50
Please enter a value for the room length::50
Please enter a value for the room height::42
The area of the floor of the room is: 2500The volume of the room is: -26072The ratio of the width to the length is: 1072693248