write a program in Java to find out if a number entered by user is a duck number
aditya4844:
what is duck number
Answers
Answered by
0
What is a duck number....?
Answered by
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
Art,
7 months ago
Political Science,
7 months ago
India Languages,
7 months ago
English,
1 year ago
Accountancy,
1 year ago
Math,
1 year ago