In this tutorial you will learn about the Passing Division Program in Java and its application with practical example.
In this tutorial, we will learn to create a Java to Program Find Passing Division Program in Java using java programming.
Before starting with this tutorial, we assume that you are best aware of the following Java programming concepts:
- Java Operators.
- Basic Input and Output function in Java.
- Class and Object in Java.
- Basic Java programming.
- If-else statements in Java.
- For loop in Java.
How to Calculate percentage?
Percent is one out of one hundred parts, i.e., A ratio of the parts out of 100. Symbol of a percent is “%”.
Passing Division Program in Java
In this program we will find Passing Division number provided by user. first will take the input from the user and then calculate passing percentage of a user. Lets have look at the Code.
// java program to calculate passing Divison..
public class Passing_Division
public static void main(String args)
// Declaring variables and taking values from user at run time..
int m, e, s, art, com, total, per;
Scanner sc = new Scanner(System.in);
System.out.println("Enter marks out of 100");
System.out.print("Enter math marks= ");
m = sc.nextInt();
System.out.print("Enter English marks= ");
e = sc.nextInt();
System.out.print("Enter science marks= ");
s = sc.nextInt();
System.out.print("Enter art marks= ");
art = sc.nextInt();
System.out.print("Enter computer marks= ");
com = sc.nextInt();
total = m + e + s + art + com;
System.out.println("Total marks out of 500=" + total);
per = total / 5;
System.out.println("Percent of marks=" + per);
if (per < 33)
else if ((per >= 33) && (per < 45))
else if ((per >= 45) && (per < 60))
In the above program, we have first declared and initialized a set variables required in the program.
- m = it will hold entered math’s number.
- e = it will hold entered English number.
- s = it will hold entered science number.
- art = it will hold entered art number.
- com = it will hold entered computer number.
- total= it will hold total of all subject.
- per =it will hold percentage of a student.
After that we take 5 subjects values form user.
and then after that we add all values in variable total and
then after find percentage
and finally we will print the percentage according to inputted values.