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循环
    
    
  • 相关阅读:
    luogu_1339 [USACO09OCT]热浪Heat Wave
    luogu_1341 无序字母对
    luogu_1330 封锁阳光大学
    luogu_3383 【模板】线性筛素数
    luogu_1095 守望者的逃离
    luogu_1373 小a和uim之大逃离
    查看寄存器
    Assembly oth
    非常详细的端口表汇总
    公式证明
  • 原文地址:https://www.cnblogs.com/cuikang/p/5017439.html
Copyright © 2011-2022 走看看