#22 How to use While Loop in Java | Odd Even Program in java using While Loop

package com.sudhirtheindian2.java123;

import java.util.Scanner;

public class whileloop {
public static void main(String[] args) {

// How to use while loop in java

// syntax---

// while(condition){
// //code
// }

System.out.println("enter the number");
Scanner scanner = new Scanner(System.in);
int num = scanner.nextInt();

while (num>=0){
if(num%2==0){
System.out.println("even number");
break;
}
else {
System.out.println("odd number");
break;

}

}








}
}

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट

Download Hindi Sanskrit Grammar App

HackerRank Java Currency Formatter (Hacker Rank Problem Solution)