This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
hello all, I am taking an intro to programming course and am finding an issue with one of my labs. it is a BMI calculator program. Below is what I have so far but when i build it to test it out i get "return value ignored scanf for line 16 and 18. for line 17 and 19 i get "scanf this function may be unsafe consider using scanf_s instead. to disable deprecation use CRT SCURE NOT WARNINGS.
I have that included as you can see but still get the same answer. i dont know what i am missing, or even if the title of my post is correct. I am only 7 weeks in to my course and have been struggling a bit anyways.
I also tried plugging the code into chatgpt but it did not help.
#define _CRT_SCURE_NO_WARNINGS
#include <stdio.h>
int main()
{
float weight, height, bmi;
printf("\\n\\t Enter Weight in lbs\\t");
scanf("%f", &weight);
printf("\\n\\t Enter height in inches\\t");
scanf("%f", &height);
bmi = weight / (height \* height);
if (bmi <= 18.5)
{
printf("BMI is : %.22f -> Underweight", bmi);
}
else if (bmi <= 24.9)
{
printf("BMI is : %.2f -> Normal", bmi);
}
else if (bmi >= 25 && bmi <= 29.9)
{
printf("BMI is : %.2f -> Overweight", bmi);
}
else
printf("BMI is : %.2f -> Obese", bmi);
return 0;
}
Subreddit
Post Details
- Posted
- 7 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/C_Programmi...