Computer Science, asked by aastha1620, 4 months ago

Write a program in java to ask the user to enter any no. and verify whether it is a zippo no. or not.​

Answers

Answered by Anonymous
0

 {\boxed{\underline{\purple{\bf\tt{Program:} } }}}

System.out.printIn("Enter a number");

 \: \: \: \: int zip=ss.nextInt();

 \: \: \: \: int n=zip, c=0,e=0,r=0;

 \: \: \: \: while(zip>00)

 \: \: \: \: {

 \: \: \: \: \: \: \: \: zip=zip/10;

 \: \: \: \: \: \: \: \: c++;

 \: \: \: \: }

 \: \: \: \: int d=c-2;

 \: \: \: \: while (n>0)

 \: \: \: \: {

 \: \: \: \: \: \: \: \: r=n%10;

 \: \: \: \: \: \: \: \: if (r==0)

 \: \: \: \: {

 \: \: \: \: \: \: \: \:  \: \: \: \: e++;

 \: \: \: \: }

 \: \: \: \:  \: \: \: \: n=n/10

 \: \: \: \: }

 \: \: \: \: If (d==e)

 \: \: \: \: System.out.printIn("Yes, it is a zippo number");

 \: \: \: \: else

 \: \: \: \: System.out.printIn("No, it isn't a zippo number");

 \: \: \: \: }

}

Similar questions