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.in); 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 { flag=0; break; } t=t/10; } if(flag==1) System.out.println(n+" is a Corona Number"); else System.out.println(n+" is not a Corona Number"); } }

Lokendra MauryaVery Helpful Sir. Thanks For this

BdhdgzbsbThnx

Akshara SrivastavaThanks a lot sir….. Your are simplifying all the complex programs….. Like encapsulation you are encapsulating all the complexity behind…..