《c语言入门题目5》根据父母身高估算儿子的身高

编程知识 更新时间:2023-04-06 20:10:06

前言:(内容仅供分享和参考)

理想很丰满,现实很骨感(悲)

理论和现实,差了个十几厘米呢(我哭死)

========================================================================

编程代码:(用到的软件:Dev-C++)

#include<stdio.h>  
    #define HEG 0.54        
    float height(float father,float mother);             
    int main()  
 {
       float father;     
       float mother;     
       float son;       
       printf("请输入父亲身高:\n");
       scanf("%f",&father);            

       printf("请输入母亲身高:\n");  
       scanf("%f",&mother);            
       
       son=height(father,mother);       
       printf("预测儿子身高: ");    
       printf("%.2f\n",son);         
       return 0;                  
}
 float height(float father,float mother)     
 {
       float son =(father+mother)*HEG;   
       return son;                       
 }

#include<stdio.h>  
    #define HEG 0.54        
    float height(float father,float mother);             
    int main()  
 {
       float father;     
       float mother;     
       float son;       
       printf("请输入父亲身高:\n");
       scanf("%f",&father);            

       printf("请输入母亲身高:\n");  
       scanf("%f",&mother);            
       
       son=height(father,mother);       
       printf("预测儿子身高: ");    
       printf("%.2f\n",son);         
       return 0;                  
}
 float height(float father,float mother)     
 {
       float son =(father+mother)*HEG;   
       return son;                       
 }

========================================================================

结果图:

更多推荐

《c语言入门题目5》根据父母身高估算儿子的身高

本文发布于:2023-04-06 20:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/c92981d26c23f103fddbfb1be8b8bdb4.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身高   入门   题目   儿子   父母

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 50653文章数
  • 14阅读数
  • 0评论数