java Multiple_Of_2_or_5_But_Not_Both

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java Multiple_Of_2_or_5_But_Not_Both相关的知识,希望对你有一定的参考价值。

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BASICJAVA;

import java.util.Scanner;

/**
 *
 * @author ABIR
 */
public class Multiple_Of_2_or_5_But_Not_Both {
    public static void main(String[]args){
        Scanner abir =new Scanner(System.in);
        System.out.println("Enter your first number");
        int number=abir.nextInt();
        if(number%2==0 && number%5==0){
            System.out.println("Number is Multiple by 2 and 5");
        }else{
            if(number%2==0){
                System.out.println("Multiple of 2 = "+number);
            }else{
                if(number%5==0){
                    System.out.println("Multiple of 5 = "+number);
                }
            }
        }
    }
}

以上是关于java Multiple_Of_2_or_5_But_Not_Both的主要内容,如果未能解决你的问题,请参考以下文章

(Protocol.UndefinedError) 协议 Enumerable 未实现 3

ThinkPHP 中 where条件 or,and 同时使用

Java练习题2_13_1331

05_Java基础语法_第5天(方法)_讲义

THINKPHP and or 模板语句书写

C语言错误:error: expected ':', ',', ';', '' or '__attribute__' b