Advertisement
Guest User

L4Continued.java

a guest
Dec 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. public class L4Continued{
  2.    public static void main(String[] args){
  3.       int score = 0;
  4.       System.out.println("Your score is " + score);
  5.       //add 15 to score
  6.       score = score + 15;
  7.       System.out.println("Your score is " + score);
  8.       score = score + 15;
  9.       System.out.println("Your score is " + score);
  10.       score = score + 10;
  11.       System.out.println("Your score is " + score);
  12.      
  13.       //Let's make a countdown 5...4...3...2...1...Lift Off!
  14.       int countdown = 5;
  15.       System.out.println( countdown + "..." );
  16.       countdown--;
  17.       System.out.println( countdown + "..." );
  18.       countdown--;
  19.       System.out.println( countdown + "..." );
  20.       countdown--;
  21.       System.out.println( countdown-- + "..." );
  22.       System.out.println( --countdown + "..." );
  23.      
  24.       //Make a program to print the powers of 2
  25.       int base = 2;
  26.       int power = 1;//2^0
  27.       System.out.println( power );
  28.       power *= base;
  29.       System.out.println( power );
  30.       power *= base;
  31.       System.out.println( power );
  32.       power *= base;
  33.       System.out.println( power );
  34.       power *= base;//power = power * base
  35.       System.out.println( power );
  36.    }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement