c - Scanf always returning 0.000000 -



c - Scanf always returning 0.000000 -

i'm trying create simple programme calculate body mass index, scanf(s) homecoming 0.00000, no matter try. searched everywhere, tried many things, everyone.

#include <stdio.h> #include <stdlib.h> int main() { float height; float initialheight; float weight; float bmi; float nothing; printf("what's weight? "); scanf("%lf", &weight); printf("%f", &weight); printf("what's height? "); scanf("%lf", &initialheight); printf("%f", &initialheight); height = (initialheight * initialheight); printf("%f", &height); bmi = (weight / height); printf("your bmi "); printf("%f", &bmi); scanf("%f", nothing); //just maintain programme open homecoming 0; }

well have alter 2 things. first, alter printf("%f", &weight) printf("%f", weight). , alter scanf("%lf", &weight) scanf("%f", &weight) create programme fine.

c floating-point int printf scanf

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -