Addition ,multiplication ,division ,subtraction of a number.

Addition ,multiplication ,division ,subtraction of a number.



//Addition ,multiplication ,division ,subtraction of a number.
package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
// write your code here
float a,b,sum,sub,mul,div,mod;
Scanner input = new Scanner(System.in);
System.out.println("Enter two number ");
System.out.print("fist number : ");
a = input.nextFloat();
System.out.print("second number : ");
b= input.nextFloat();
sum=a+b;
sub=a-b;
mul=a*b;
div=a/b;
mod=a%b;
System.out.println("Sum of two number is : "+sum);
System.out.println("Product of two number is : "+mul);
System.out.println("Difference of two number : "+sub);
System.out.println("Division of number is : "+div);
System.out.println("Mod of number is : "+mod);

}
}
Enter two number 
fist number : 125
second number : 24
Sum of two number is : 149.0
Product of two number is : 3000.0
Difference of two number : 101.0
Division of number is : 5.2083335
Mod of number is : 5.0

Process finished with exit code 0

Comments

Popular posts from this blog

the distance between two cities (in km is input through the keyboard. write a program to convert and print this distance in meter ,feet inches and centimeter.

CREATE UNIT CONVERTER APP

write a program to check whether a triangle is valid or not, when the threeangles of the triangle are entered through the keyboard. A triangle is valid if the sumof all the three angles is equal to 180 degrees