#include<stdio.h>
#include<conio.h>main()
{
char name [30];
char id;
int height;
float weight;
float bmi;
// inputprintf("\n Enter your name:");
scanf("%s",&name);printf("\n Enter your Matric Number:");
scanf("%s",&id);printf("\n Enter your weight(kg):");
scanf("%.2f",&weight);printf("\n Enter your height(m):");
scanf("%d",height);//process
bmi = (weight / (height * height));
// output
printf("\n\n Name: %s", name);
printf("\n\n Matric Number: %s", &id);
printf("\n\n Your BMI: %.2f", &bmi);getch();
}
I am not near a C++ compiler, but I think you have a problem here: printf("\n\n Matric Number: %s", &id);
printf("\n\n Your BMI: %.2f", &bmi);There is no need for the address:
printf("\n\n Matric Number: %s", id);
printf("\n\n Your BMI: %.2f", bmi);
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |