Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Divide 2 numbers
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Abhi
Divide 2 numbers
1 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners


Write a java program to divide 2 numbers. Avoid division by zeor by catching the exception.


Advertisement
View Answers

March 20, 2012 at 3:00 PM


class Divide 
{
    public static void main(String[] args) 
    {
        try{
        int num1=8;
        int num2=4;
        int div=num1/num2;
        System.out.println(div);
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
}


Related Tutorials/Questions & Answers:
Divide 2 numbers
Divide 2 numbers  Write a java program to divide 2 numbers. Avoid division by zeor by catching the exception.   class Divide { public static void main(String[] args) { try{ int num1=8
divide a page
divide a page   how to divide a page using jsp in three different column and in which , in first column , there is a phone number box,whenever a phone numhber is given immediately it will shown in below of the phone box
Advertisements
divide a page
divide a page   how to divide a page using jsp in three different column and in which , in first column , there is a phone number box,whenever a phone numhber is given immediately it will shown in below of the phone box
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers... divide and conquer? Thanks All
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers... divide and conquer? Thanks All
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers... divide and conquer? Thanks All
divide html page
divide html page   how to divide html page into 3 parts without using frames
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??  import javax.microedition.midlet....=new Form("Addtion of two numbers"); // result=new Command("Result
divide the line in to two
divide the line in to two  In| this |example |we| are| creating |an |string| object| .We| initialize| this| string |object| as| "Rajesh Kumar"|.| We| are| taking| sub| string | In above mentioned line based on the tag i want
how to divide 1 web page into some parts...
how to divide 1 web page into some parts...  how to divide 1 web page... home page,bt m nt knowing how to divide that into frames in jsp.   <...-width:2;"> <img src="C:\\image.jpg" height="100" width="1024"><
how to divide 1 web page into some parts...
how to divide 1 web page into some parts...  how to divide 1 web page... home page,bt m nt knowing how to divide that into frames in jsp.  <...-width:2;"> <img src="C:\\image.jpg" height="100" width="1024"><
Numbers pyramid
Numbers pyramid  Hi sir, Can you please tell me how to output this using nested for loops? 1 2, 1 1, 2, 3 4, 3, 2, 1 1, 2, 3, 4, 5 6, 5, 4, 3, 2, 1 1, 2, 3, 4, 5, 6, 7 8, 7, 6, 5, 4, 3, 2, 1 1, 2, 3, 4, 5, 6, 7, 8, 9 10, 9, 8
Listing all even numbers between two numbers
Listing all even numbers between two numbers  Hi, How to write code to list all the even numbers between two given numbers? Thanks   Hi, You function will take 2 numbers and the find the even numbers between
how to divide a web page into some frames.....
how to divide a web page into some frames.....  how to divide 1 web page into some parts. i know it using frames in html,bt how can we do it in jsp... page,bt m nt knowing how to divide that into frames in jsp.  Please go
automorphic numbers
automorphic numbers  how to find automorphic number in java   Hi Friend, Pleas visit the following link: Automorphic numbers Thanks
sorting numbers
sorting numbers  How to sort the numbers in ascending order   import java.util.*; class SortNumbers{ public static void main(String...=input.nextInt(); list.add(num); } System.out.println("Numbers
Java divide method example
Java divide method example       In this example Java bigdecimal class divide (BigDecimal...); Java_BigDecimal_divide_BigDecimal_divisor_MathContext_mc.java
Prime Numbers
Prime Numbers  Create a complete Java program that allows the user to enter a positive integer n, and which then creates and populates an int array with the first n prime numbers. Your program should then display the contents
Rational Numbers
Rational Numbers   Write and fully test a class that represents rational numbers. A rational number can be represented as the ratio of two integer values, a and b, where b is not zero. The class has attributes for the numerator
Java Query divide frame into 3 rows and 3 columns
Java Query divide frame into 3 rows and 3 columns  how can we divide the frame into 3 rows and 3 columns
Application for print pyramid of numbers
Application for print pyramid of numbers  What is the code for printing the numbers like 1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
odd numbers with loop
odd numbers with loop  get the odd numbers till 100 with for,while loop   Java find odd numbers: class OddNumbers { public static...++){ if(i%2!=0){ System.out.println(i
Struts 2 Format Examples
Struts 2 Format Examples       In this section you will learn how to format Date and numbers in Struts 2 Framework. Our Struts 2 Format Examples are very easy to grasp and you will learn these concepts
how to divide 1 web page into some parts using div tag...
how to divide 1 web page into some parts using div tag...  how to divide 1 web page into some parts. i know it using frames in html,bt how can we do... creating home page,bt m nt knowing how to divide that into frames in jsp
Java BigDecimal divide examples
Java BigDecimal divide examples       In this example, Java bigdecimal class divide(BigDecimal... divide(BigDecimal divisor, int scale, int roundingMode)   
how to add to numbers in java
how to add to numbers in java  how to add to numbers in java
Prime Numbers - IDE Questions
Prime Numbers  Create a program that calculates the prime numbers... numbers in rows of 10. Hint: Use a counter to count how many values are printed... = 0; System.out.println("Prime Numbers are:" ); for (int i = 1; i <
Hexadecimal numbers multiplication
Hexadecimal numbers multiplication  Sir, I have to multiply 128 bit hexadecimal numbers. Do u have any logic for this?? The numbers are like ab7564fa342b5412c34d9e67ab341b58
Addition of two numbers
Addition of two numbers  addition of two numbers
defining numbers in Java Script
defining numbers in Java Script  Explain about defining numbers in Java Script
Advertisements
 

 

 

DMCA.com