CORONA Number – Java Program

Write a program to accept a number and check whether it is a CORONA number or not.

CORONA NUMBER: A number whose all digits are odd.
Example: 3975 – all digits are odd

import java.util.Scanner;
class CoronaNumber
    public static void main(String args[])
        Scanner in = new Scanner(;
        System.out.println("Enter a number");
        int n=in.nextInt();
        int flag=1;
        //check corona number
        int t=n;
        while(t>0) // taking out digits
            int d=t%10;
            if(d%2==0)//condition to check even number
            System.out.println(n+" is a Corona Number");
            System.out.println(n+" is not a Corona Number");

2 thoughts on “CORONA Number – Java Program”

Leave a Comment

Your email address will not be published. Required fields are marked *