Advertisement
aknan_z

input variables

Nov 29th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. //aknan
  2. //October 22, 2015
  3. import java.util.Scanner;
  4.  
  5. public class InputHW
  6. {
  7.   public static void main(String[]args)
  8.   {
  9.     Scanner input= new Scanner (System.in);
  10.    
  11.    
  12.     System.out.println("What is your name?");
  13.     String name=input.nextLine();
  14.    
  15.     System.out.println(name+"Pick an integer");
  16.     int a =input.nextInt();
  17.     System.out.print(name+"Pick another integer");
  18.     int b=input.nextInt();
  19.     System.out.println(name+"Pick another integer");
  20.     int c=input.nextInt();
  21.     int  sum = a+b+c;
  22.     System.out.println("The sum is"+ sum);
  23.     int difference= a-b-c;
  24.     System.out.println("The difference is"+ difference);
  25.     int product= a*b*c;
  26.     System.out.println("The product is" + product);
  27. }//Close main
  28. }//Close class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement