Computer Science, asked by swati0325, 20 days ago

Write a program to input a number(maximum 9 digits) and print the following: a) Total number of even digits and odd digits b) The reverse of the number c) Total number of zero's present in the number.​

Answers

Answered by akshat1216
0

Answer:

yughj

Explanation:

fujfffcucuggyuub. bbbbh. vivl ohcof

Answered by sahupriyanshu710
1

Answer:

import java.util.*;

public class Digit{

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

System.out.println("Entet a no. of not more than 9 digits");

int ct=0,c=0,cn=0,sum=0;

int n=sc.nextInt();

if(n>999999999){

return;}

else

while(n>0){

int d=n%10;

if(d==0){

ct++;}

if(d>0 && d%2==0){

c++;}

if(d%2!=0){

cn++;}

sum=(sum*10)+d;

n/=10;

}

System.out.println("Total no.of even digits="+c+"\nTotal no.of odd digits="+cn+"\nTotal no of zeros="+ct+"\nThe reversed no. ="+sum);

}

}

Similar questions