Computer Science, asked by Rainbowgain, 2 months ago

write a program in java to print duck number​

Answers

Answered by sarakamal2589
3

Class duck

{

void main (int n)

{

int r , int e = 0;

while (n!=0)

{

r= n%10

n= n/10

if (r ==0)

c++

}

if (c>=1)

system.out.println ("duck number");

else

system.out.println ("not a duck number");

}

}

Answered by Anisha5119
6

Answer:

import java.util.*;

import java.util.*;class Duck

{

{public static void main()

{public static void main(){

Scanner sc=new Scanner (System.in);

{

int n,r,p,c=0;

System.out.println("Enter the number");

n=sc.nextInt();

while (n>0)

{

r=n%10;

if(r==0)

System.out.println("Duck number");

else

System.out.println("Not a Duck num');

}

}

}

Similar questions