码迷,mamicode.com
首页 > 其他好文 > 详细

if 语句练习 身高体重问题

时间:2015-12-03 22:54:33      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

 

技术分享

 

public class d {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO 自动生成的方法存根

    
        
        int weight=130,height=175;
        boolean sex=true;
        
        if(sex=true)
        {
        int bz=height-100;
        if(bz-height<-3)
        {
        System.out.println("体重偏瘦");
        }
        else if(bz-height>=-3 && bz-height<=3)
        {
        System.out.println("体重适合");
        }
        
        else
        {
        System.out.println("体重偏胖");
        }
        }
        else
        {
        int  bz =height-110;
        if(bz-height<-3)
        {
        System.out.println("体重偏瘦");
        }
        else if(bz-height>=-3 && bz-height<=3)
        {
        System.out.println("体重适合");
        }
        
        else
        {
        System.out.println("体重偏胖");
        }
        }
    
    
    }
}
        
    

 

if 语句练习 身高体重问题

标签:

原文地址:http://www.cnblogs.com/Chenshuai7/p/5017861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!