Exception Handling in Java 2011View more random threads:
- How to extract objects in a video shot in java 2011
- What is the Java Compiler Structure
- Serialization in java
- Java - Multi-threaded
- Problem Handling Long Data types in GUI
- native code in java
- Explain the difference between 2-tier and 3 tier client...
- Signing Java Applets
- Learning Enumeration 2011
- what is boxing or unboxing and what is the uses of it in...
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)