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
Post a Comment