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
Chhod aaye the kinara kabhi apni talash mein, Par dil ki gehrayi se ek aisi aawaz aayi, Ki lautna pada hamein isi mod ki talash mein. |
|
| asked by Nisarg Bhavsar (nisarg71) 30 days ago | |
2 | |
Bengali grammar icse question paper can I get? |
|
| asked by Debosmita Malik (debosmitamalik) 84 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) 188 days ago | |
1 | |

