/*
* Autor: Juan Antonio Ripoll
* Date: 30/10/13
*
* Write a JAVA program to ask the user for a number; if it is not zero,
* then it will ask for a second number and display their product;
* otherwise, it will display "0".
* */
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter the first number: ");
int number1 = in.nextInt();
if (number1!=0)
{
System.out.print("Enter the second number: ");
int number2 = in.nextInt();
System.out.print(number1 + " X " + number2 + " = "
+ number1*number2);
}
else
System.out.print(number1);
}
}
Wednesday, October 30, 2013
2.02 - Multiply if not zero
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment