/* * Autor: Juan Antonio Ripoll * Date: 30/10/13 * * Write a JAVA program to ask the user for three numbers (a, b, c) * and display the result of (a+b)·c and the result of a·c + b·c * */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a number a: "); int number1 = in.nextInt(); System.out.print("Enter a number b: "); int number2 = in.nextInt(); System.out.print("Enter a number c: "); int number3 = in.nextInt(); System.out.println("(a+b)·c = " + (number1 + number2) * number3); System.out.println("a·c + b·c = " + ( (number1 * number3) + (number2*number3) )); } }
Wednesday, October 30, 2013
1.11 - Age
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment