zoukankan      html  css  js  c++  java
  • 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循环
    
    
  • 相关阅读:
    被学长教会的高斯消元法Gauss
    KMP字符串匹配算法翔解❤
    fkwの题目(祝松松生日快乐!)
    NOI-linux下VIM的个人常用配置
    从2017年暑假到现在手打的模板↑_↑
    【テンプレート】初级数据结构
    【テンプレート】高精
    DP(第二版)
    luogu P1029 最大公约数和最小公倍数问题
    贪心题整理
  • 原文地址:https://www.cnblogs.com/cuikang/p/5017439.html
Copyright © 2011-2022 走看看