Advertisement
irishstorm

ex8f

Nov 14th, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ex8f
  4. {
  5.    
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner input = new Scanner(System.in);
  9.         int num1, num2, num3;
  10.        
  11.         System.out.print("Enter a value ");
  12.         num1 = input.nextInt();
  13.         System.out.println();
  14.        
  15.         System.out.print("Enter a second value ");
  16.         num2 = input.nextInt();
  17.         System.out.println();
  18.  
  19.         System.out.print("Enter a third value ");
  20.         num3 = input.nextInt();
  21.         System.out.println();
  22.        
  23.         add(num1, num2, num3);
  24.     }
  25.     // Method add()
  26.     public static void add (int a, int b, int c)
  27.     {
  28.             int answer;
  29.             answer = a + b + c;
  30.             System.out.println("The sum of " + a +  " plus " +b + " plus " + c + " is " + answer);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement