20151203练习

package shiyan;

public class Yiyuanercifangcheng {

    public static void main(String[] args) {

        int a = 10, b = 20, c = 30;

        if (a == 0) {
            System.out.println("不是一元二次方程");
        } else {
            int d = b * b - 4 * a * c;
            if (d == 0) {
            } else if (d > 0) {
                System.out.println("两个不相等的实根");
            } else if (d == 0) {
                System.out.println("两个相同的实根");
            } else {
                System.out.println("没有实根");
            }
        }

    }

}
一元二次方程
package shiyan;

public class Shengaotizhong {

    public static void main(String[] args) {
        int sg = 188, tz = 91;
        boolean n = false;

        int bztz = 3;

        if (n) {
            bztz = sg - 100;
        } else {
            bztz = sg - 110;
        }

        if (bztz - sg > 3) {
            System.out.println("偏重");
        } else if (bztz - sg < -3) {
            System.out.println("偏轻");
        } else {
            System.out.println("正常");
        }
    }

}
身高 体重

//循环
        int i=10;
        while(i>0)//逻辑表达式    控制循环次数     计数器
        { 
            if(i==8)//跳过这个代码继续运算
            {
                i--;
                continue;
            }
            System.out.println(i--);
            
            if(i==5)//终止条件
            break;
        }
循环语句 while

//循环
        int i=10;
        while(i>0)
        { 
            if(i==8)
            {
                i--;
                continue;
            }
            System.out.println(i--);
            
        }
        
       do
        {
            
            System.out.println(i++);
        }
           while(i<0);//先运行一次
        
循环语句 do while
public class Test {

    public static void main(String[] args) {
        
        for (int m=0;m<10;m++)//定义m  执行条件     执行循环
        {
            if(m==8) continue;
            System.out.println("m="+m);
        }
    

}    
for循环

原文地址:https://www.cnblogs.com/cuikang/p/5017439.html