lundi 26 octobre 2020

if statement(how to print a range of numbers)

public void range(int num) {
               if(num <=10){
                        System.out.println("Test(number is valid)");
               }
            else if(num<=4){
                        System.out.println("Test2( number is valid(range 0 to 4)");
            }

I am struggling to find a solution to this problem. e.g. the parameter has a value between 5 to 10. print test. if the parameter has a value 0 to 4, print test2. I am a beginner and it would like me greatly.

Aucun commentaire:

Enregistrer un commentaire