samedi 10 octobre 2020

how to repeat the loop statement by having a conditional value in java?

***/ what i want to do is, taking input value in variable only0, and the value must be only 0, if the user inputs value 0, then it must show ("we welcome you") line and if not then repeat the same question */

System.out.println(" Press 0 to start");

    int only0 = sc.nextInt();    //taking input of the user
    
    
    if (only0 == 0) {
    
        System.out.println(" We Welcome You :-)");
 
    }
        else{
        System.out.println(" YOU ARE REQUESTED TO PRESS ONLY 0 :-)");
        
    }// if end

Aucun commentaire:

Enregistrer un commentaire