comprogzz coding

Observe the following coding in java. let the entered number be 108. find the output:- hint - log on to comprogzz.in/javageneral20.html

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.io.*;
             class General20{
               public static void main(String args[])throws IOException
                  {
                     int n;
                      InputStreamReader isr=new InputStreamReader(System.in);
                      BufferedReader br=new BufferedReader(isr);
                     do{
                      System.out.println("Enter a number");
                      n=Integer.parseInt(br.readLine());
                     }while(n<=9);
                     for(int i=9;i>=1;i--)
                    {
                    int a=n;
                    while(a>0){
                     int b=a%10;
                      if (b==i)
                      System.out.print(b+" ");
                       a/=10;
                      }
                    }
                  }
            }


The answer is 801.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

0 solutions

No explanations have been posted yet. Check back later!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...