Advertisement
Fakhru

Untitled

Nov 12th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Tralala {
  7.     public static void main(String[] args){
  8.         int y;
  9.         String text = "";
  10.          for(int x=1; x <= 5; x++){
  11.             if (x <= 4){
  12.                 y = x - 1;
  13.                 }
  14.                 else {
  15.                 y = 1;
  16.             }
  17.             System.out.println(x + " : " + y);
  18.  
  19.             if (y == 0){
  20.                 text = "is zero";
  21.             }else if(y == 1){
  22.                 text = "one time";
  23.             }else if(y == 2){
  24.                 text = "two times";
  25.          }else if(y == 3){
  26.             text = "three times";
  27.          }
  28.          System.out.println("Value" + x + " : " + text);
  29.      }
  30.  }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement