Created
September 5, 2014 18:25
-
-
Save anonymous/f07d138708ded089cab8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scanner keyb = new Scanner(System.in); | |
variable = keyb.nextInt(); | |
import java.util.Scanner; | |
public class Average3b{ | |
public static void main(String[]args){ | |
int value1, value2, value3; | |
int sum, average; | |
//Get the values | |
System.ouprintln("What is the first value?"); | |
value1 = keyb.nextInt(); | |
System.ouprintln("What is the second value?"); | |
value2 = keyb.nextInt(); | |
System.ouprintln("What is the third value?"); | |
value3 = keyb.nextInt(); | |
//calculate the sum | |
sum = value1 + value2 + value3 | |
//Find and print the average | |
average = sum / 3 | |
System.outprintln("The average is " + average); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment