# Java mathematical programming

Hello everyone

Java mathematical programming

So, friend today, I will show you how we can do multiplication, subtraction, addition, and division in java. As well as we will show you how we have to found the students percentage and give the auto-grade depend on percentage byes, now open your NetBeans or notepad and As well as

So friends, first we are doing an additional program, this additional program, we will see do a two and three numbers addition program, here we took two variable in the first addition program,

let’s start

package javaapplication8;
import java.util.Scanner;

why we should take import we java. util.scanner, because of util. scanner is a class in java API used to create a scanner object, an extremely versatile object that you can use to input alphanumeric characters from several input sources and convert them to binary data.

why we should take here a,b, a
, because this all is three are variable,
before storing any value we should a variable,
for storing that value we taking a,b,c,

in the first place, we see the add program

after that, I show you to full addition code

## 1.) Java How To Add To Numbers

``````package javaapplication8;
import java.util.Scanner;
/**
*
* @author sharm
*/
public class ancd {
public static void main(String []args)
{
Scanner p = new Scanner(System.in);
System.out.println("enter a value of a");
a =p.nextInt();
System.out.println("enter a value of b");
b =p.nextInt();

}

}``````

we are taking a=5 and b=5 so here finale both number of addition is 10

this is a output

Java mathematical programming

## 2.) Java How To multiplication To Numbers

in the multiplication program, we will take two variable

from thrre variable to we doing multiplication both values ,from third variable to we doing multiplication both values

if you want to take three variables, so here you will do add one more variable,

``````package javaapplication8;
import java.util.Scanner;
/**
*
* @author sharm
*/
public class ancd {
public static void main(String []args)
{
Scanner p = new Scanner(System.in);
float a,b,mul;
System.out.println("enter a value of a");
a =p.nextInt();
System.out.println("enter a value of b");
b =p.nextInt();
mul = a*b;

}

}``````

this is multiplication program out put

here we taking a two integer value

thank you.

## 3.) Java How To Division To Numbers

in the division program, we will take two variable.

here first we taking a value from user and than after in third variable to we doing division.

``````package javaapplication8;
import java.util.Scanner;
/**
*
* @author sharm
*/
public class ancd {
public static void main(String []args)
{
Scanner p = new Scanner(System.in);
float a,b,div;
System.out.println("enter a value of a");
a =p.nextInt();
System.out.println("enter a value of b");
b =p.nextInt();
div = a/b;

}

}``````

this is simple two int value division output.

## 4.)Java How To subtraction To Numbers

in the subtraction program we taking a two variable, As well as we will watch student percentage program in java in next post

so now we doing a focuses in subtraction program.

let’s start

Java mathematical programming

``````package javaapplication8;
import java.util.Scanner;
/**
*
* @author sharm
*/
public class ancd {
public static void main(String []args)
{
Scanner p = new Scanner(System.in);
float a,b,sub;
System.out.println("enter a value of a");
a =p.nextInt();
System.out.println("enter a value of b");
b =p.nextInt();
sub = a-b;

}

}``````

so friend here I am shirring final subtraction output. and

and As well as shear our website with your friends:- https://learningpoints.in/

thank you.