Advertisement
urksiful

Cinco

Nov 2nd, 2015
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class Cinco {
  5.  
  6.     public static void main(String args[]) {
  7.         Scanner x = new Scanner(System.in);
  8.  
  9.         int score = 0;
  10.         int pos = 0;
  11.  
  12.         int indexOut[] = new int[5];
  13.  
  14.         for (int i = 0; i < indexOut.length; i++) {
  15.             indexOut[i] = x.nextInt();
  16.             if (i > 0) {
  17.                 indexOut[i] *= indexOut[i - 1];
  18.             } else {
  19.                 indexOut[i] *= 3;
  20.             }
  21.  
  22.         }
  23.  
  24.         for (int i = 0; i < indexOut.length; i++) {
  25.             if (i < indexOut.length - 1) {
  26.                 if (indexOut[i] < indexOut[i + 1]) {
  27.                     score += 2;
  28.                 } else {
  29.                     pos += 1;
  30.                 }
  31.             }
  32.         }
  33.  
  34.         System.out.println("The players has a new score " + score + " but isn't good for " + pos + " reasons");
  35.  
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement