Java program to divide two numbers(getting input from the user)
Answers
Answered by
0
Answer:
Write a Java program to divide two numbers and print on the screen.
Division is one of the four basic operations of arithmetic, the others being addition, subtraction, and multiplication. The division of two natural numbers is the process of calculating the number of times one number is contained within one another.
Pictorial Presentation:
Java dividing two numbers
mark me as brainlist
Attachments:
Answered by
0
Answer:import java.io.*;
class xyz
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read) ;
int divisor, dividend,ans;
System.out.println("Enter n1");
dividend=Integer.parseInt(in.readLine);
System.out.println("Enter n2");
divisor=Integer.parseInt(in.readLine);
ans=dividend/divisor;
System.out.println("Answer is"+ans);
}
}
Similar questions
Physics,
4 months ago
Math,
4 months ago
English,
4 months ago
Math,
9 months ago
English,
9 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago