title: How to find second largest number using Scanner and for loop(no array)
body: <p>So I can easily accomplish task to find largest number and then if can be divided by three, print out. But do not know how to find second largest number from users sequence.
  Thanks for any hints!</p>
  
  <pre><code>public class SecondLargest {
  
      public static void main(String[] args) {
          int max = 0;
          Scanner scan = new Scanner(System.in);
          System.out.println("How many numbers?");
          int n = scan.nextInt();
  
          System.out.println ("Write numbers: ");
          for(int i=0; i&lt;n; i++){
              int c = scan.nextInt();
              if(c&gt;=max &amp;&amp; c%3 == 0){
                  max = c;
                  }
              else
                  System.out.println("There is no such number.");
  
  
  
          }
          System.out.println(max);
      }
  }
  </code></pre>