Computer Science, asked by rekhagarg13, 6 months ago

input a number and display its even digits only in blue j​

Answers

Answered by BrainlyProgrammer
2

Answer:

int n=Sc.nextInt();

while(n!=0)

{

d=n%10;

if (d%2==0)

System.out.println(d);

n/=10;

}

Answered by anindyaadhikari13
4

Question:-

WAP to input a number and display it's even digit.

Program:-

import java.util.*;

class Number

{

public static void main(String s[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter a number: ");

int n=sc.nextInt();

System.out.print("Even digits are: ");

while(n!=0)

{

int d=n%10;

if(d%2==0)

System.out.print(d+" ");

n/=10;

}

}

}

Similar questions