Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class L4Continued{
- public static void main(String[] args){
- int score = 0;
- System.out.println("Your score is " + score);
- //add 15 to score
- score = score + 15;
- System.out.println("Your score is " + score);
- score = score + 15;
- System.out.println("Your score is " + score);
- score = score + 10;
- System.out.println("Your score is " + score);
- //Let's make a countdown 5...4...3...2...1...Lift Off!
- int countdown = 5;
- System.out.println( countdown + "..." );
- countdown--;
- System.out.println( countdown + "..." );
- countdown--;
- System.out.println( countdown + "..." );
- countdown--;
- System.out.println( countdown-- + "..." );
- System.out.println( --countdown + "..." );
- //Make a program to print the powers of 2
- int base = 2;
- int power = 1;//2^0
- System.out.println( power );
- power *= base;
- System.out.println( power );
- power *= base;
- System.out.println( power );
- power *= base;
- System.out.println( power );
- power *= base;//power = power * base
- System.out.println( power );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement