Why it is not working. It is a program for Duck Number
import java.util.Scanner;
public class magic
{
public static void main (String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("ENTER NO TO CHECK");
int num = sc.nextInt();
String str = Integer.toString(num);
int len = str.length();
int count = 0;
int i;
for(i=0 ; i <len ; i++)
{
if ( str.charAt(i) == '0')
count ++;
}
if(count > 0 && str.charAt(0) != '0')
System.out.println("It is a Duck Number");
else
System.out.println("It is not a Duck Number");
}
} |
|
| asked by Ansh Anand (teleansh) 7 years ago | |
2 | |
Other Questions on This Topic
Bengali grammar icse question paper can I get? |
|
| asked by Debosmita Malik (debosmitamalik) 21 days ago | |
1 | |
I wish to download question papers for ICSE prelims and I cannot do that. Can you provide the details of the Customer support for Respaper to get in touch with regarding the issue mentioned above. |
|
| asked by S.Hemalata Rajaram (hema1877) 124 days ago | |
1 | |

