变量赋值判断奇偶

 int number = 18;
        
        number = number % 2;
                
        if (number == 1)
        {                System.out.println("奇数" );}
        else 
        {                System.out.println("偶数" );}

 

posted @ 2015-09-29 23:05  老趙  阅读(214)  评论(0编辑  收藏  举报