Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- System.out.println("This is a long string that is the " + "concatenation of two shorter strings.");
- System.out.println("The first computer was invented about " + 55 + " years ago.");
- System.out.println("8 plus 5 is " + 8 + 5);
- System.out.println("8 plus 5 is " + (8 + 5));
- System.out.println(8 + 5 + " equals 8 plus 5.");
- System.out.println("Ten robins plus 13 canaries is" + (10 + 13) + "birds.");
- final int NUM_1 = 55;
- int num2 = 23;
- num2 = 45;
- int myNumber = 45;
- myNumber = 12 + 12;
- // prelabs============================================
- int val1, val2, val3;
- double average;
- Scanner scan = new Scanner(System.in);
- // get three values from user
- System.out.println("Please enter three integers and " + "I will compute their average");
- val1 = scan.nextInt();
- val2 = scan.nextInt();
- val3 = scan.nextInt();
- // compute the average
- average=(val1+va2+val3)/3;
- // print the average
- System.out.println("Average of three numbers: "+average);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement