Skip to content

Instantly share code, notes, and snippets.

Created September 5, 2014 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f07d138708ded089cab8 to your computer and use it in GitHub Desktop.
Save anonymous/f07d138708ded089cab8 to your computer and use it in GitHub Desktop.
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