Advertisement
ZhenghaoZhu

FindAvg

Oct 30th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. //Zhenghao Zhu
  2. //FindAvg
  3. //10/30/2015
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class FindAvg{
  8.   public static void main (String []args){
  9.  
  10.     Scanner input = new Scanner(System.in);
  11.     System.out.println("What is your full name?");
  12.     String fullname = input.nextLine();
  13.     System.out.println(fullname + " could you please give me 2 numbers?");
  14.     double n1 = input.nextDouble();
  15.     double n2 = input.nextDouble();
  16.     double avg = n1+n2 / 2;
  17.     System.out.println("The average of " + n1 + " and " + n2 + " is " + avg + ".");
  18.      
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement