Discuss If statment help in the C Programming forum on Dev Shed. If statment help C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Time spent in forums: 2 h 8 m 19 sec
Reputation Power: 0
If statment help
I am wanting to write a program for a BMI calculator that eventually will record details for several entries.
However to start with I need to be able to just complete one calculation.
Below is my code which works up to the if statement what I am trying to do is once I have completed the calculation be able to take that result and use the if statement to indicate if the result is normal, under or over.
I don't know how to take the result and put it into the if statement.
float height, weight,bmi;
printf("Enter Weight in Kg's and Height in METERS \n");
scanf("%f%f", &weight, &height );
bmi = weight/(height*2);
printf("Your BMI is %.2f\n",bmi);
printf("your weight is normal\n");
Time spent in forums: 3 Months 1 Day 4 h 11 m 54 sec
Reputation Power: 2199
That is utter nonsense.
The scanf does nothing. And the if statement is comparing the address with 25. Since the first K or so of memory belongs to the operating system, such as the interrupt vector table, I think it's a very safe guess that that string literal, which is co-located with the program image in RAM, is far greater than memory address 25.