Exception Handling in Java 2011View more random threads:
- Specifiation vs. Framework
- need guidness in java 2011
- Proplem in code .help please
- how PageSpeed Insights works for your page analysis breif...
- about DAO in java 2011
- Java as Object Oriented programming languge 2011
- Using wait and notify? in java 2011-12
- what are classes in java 2011 ?
- Java Error: <\bin\hotspot\jvm.dll> error message during...
- JAVA Error: Old file not found
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)