Computer Science, asked by Rahulverma32, 1 year ago

write a program in Java to find out if a number entered by user is a duck number


aditya4844: what is duck number
Rahulverma32: a number in which 0 is present like some examples - 2011,2340,4045 etc.
aditya4844: in which clas are you
aditya4844: *class

Answers

Answered by arpan7de
0

What is a duck number....?

Answered by irakhedkar
1

Answer:

import java.util.*;  

class Duck_Number

{  

  static int check_duck( String number)  

  {  

      int length = number.length();  

      int count_zero = 0 ;  

      char ch;  

   

      for(int i = 1;i < length ;i++)  

      {  

          ch=number . char At (i);  

          if(ch=='0')  

              count_zero++;  

      }    

      return count_zero ;  

  }  

     

Hope this helps,

Hoping for the Brainliest Crown,

ira. (had to put spaces in char at part due to errors in posting the answer)

Similar questions