fork download
  1. #include <stdio.h>
  2. float bmi( float, float ) ;
  3. int main(void) {
  4. float height, weight, value ;
  5. printf("体重を入力してください:");
  6. scanf("%f", &weight ) ;
  7. printf("%f \n", weight);
  8. printf("身長を入力してください:");
  9. scanf("%f", &height ) ;
  10. printf("%f\n", height) ;
  11. value = bmi( weight, height ) ;
  12. printf("BMI指数:%f \n", value ) ;
  13. return 0;
  14. }
  15. float bmi( float x, float y ){
  16. float z ;
  17. z = x / y / y ;
  18. return z ;
  19. }
  20.  
Success #stdin #stdout 0s 5508KB
stdin
69.3
1.715
stdout
体重を入力してください:69.300003 
身長を入力してください:1.715000
BMI指数:23.561611