Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zhenghao Zhu
- //FindAvg
- //10/30/2015
- import java.util.Scanner;
- public class FindAvg{
- public static void main (String []args){
- Scanner input = new Scanner(System.in);
- System.out.println("What is your full name?");
- String fullname = input.nextLine();
- System.out.println(fullname + " could you please give me 2 numbers?");
- double n1 = input.nextDouble();
- double n2 = input.nextDouble();
- double avg = n1+n2 / 2;
- System.out.println("The average of " + n1 + " and " + n2 + " is " + avg + ".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement