Page 257 - CA_Blue( J )_Class9
P. 257

Program 12     Write a program to display all duck numbers between 50 and 100.

                   1      class duck {

                   2          public static void main () {
                   3              int m,n,r=0,f,t,i;

                   4              for(i=51;i<=99;i=i+1)
                   5              {

                   6              t=i;
                   7              while(t>0)

                   8              {   r= t % 10;
                   9                  if(r==0)

                  10                      break;
                  11                  t=t/10;

                  12              }
                  13              if (r==0)

                  14                  System.out.println(i + " is a Duck number.");
                  15              }
                  16          }

                  17      }


                 You will get the following output:






































                                                                                                   Nested Loop   255
   252   253   254   255   256   257   258   259   260   261   262