Exception Handling in Java 2011View more random threads:
- The JVM "verifier" checks the code when it is loaded to...
- tutorial about the practical usage of the SQL 2011
- execution of programms in java
- ArrayLists behave like the same instance in ArrayList of...
- Definition and introduction about java Libraries
- about DAO in java 2011
- native code in java
- what is difference between TCP/IP protocol and http...
- Signing Java Applets
- How to run a java file that creaded in Ntebeans in console
Sponsored Links
Code:import java.util.Scanner; public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner input = new Scanner( System.in); int Num1, Num2=1, sum, product, difference; float division; try { while(Num2 !=0) { System.out.print("Enter first Number: "); Num1 = input.nextInt(); System.out.print(" Enter Second Number: "); Num2 = input.nextInt(); sum = Num1 + Num2; product = Num1 * Num2; difference = Num1 - Num2; division = (float)Num1/(float)Num2; System.out.printf("Sum =%d\n", sum); System.out.printf("Product =%d\n", product); System.out.printf("The difference =%d\n", difference); System.out.printf("Divion is %.3f\n ", division); } } catch(Exception e) { System.err.println("Error " + e.getMessage()); } } }
There are currently 1 users browsing this thread. (0 members and 1 guests)