Sum Difference Product Quotient coderinme

Sum Difference Product Quotient coderinme

Sum Difference Product Quotient
Given any two numbers like a and b
sum = a + b
difference = a- b
product = a * b
quotient = a / b
Write a java program for finding the sum, difference, product, quotient, minimum and maximum of any two integers.
Program:

import java.io.*;
public class Q7 
{
public static void main(String[] args) throws IOException 
{
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
double a,b;
System.out.print("Enter the first number: ");
a=Double.parseDouble(inp.readLine());
System.out.print("Enter the second number: ");
b=Double.parseDouble(inp.readLine());
System.out.println("The sum of two number is :"+(a+b));
System.out.println("The difference of two number is :"+(a-b));
System.out.println("The product of two number is :"+(a*b));
System.out.println("The quotient of two number is :"+(a/b));
System.out.println("The maximum of two number is :"+Math.max(a,b));
System.out.println("The minimum of two number is :"+Math.min(a,b));
}
}

For more programs on Java, visit our Java Archives

Sum Difference Product Quotient coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.