Write a program that calculate percentage marks of the student if marks of 6 subjects are given

Write a program that calculate percentage marks of the student if marks of 6 subjects are given

Explanation:

Hello friends So Basically you have to write program to calculate percentage of 6 Subject’s marks (you have to take value of 6 subject’s marks from user.)

so how you are going to write java program for counting percentage let’s see the logic going use behind this program

you have to count percentage of 6 subjects so you have to perform addition of 6 subject’s marks and multiply result with 100 and divide by 600 [Ex: (addition of 6 subject’s marks * 100) / 600 = you get value in percentage]

the result you are getting is in decimal form so you have to use float variable to store it (Ex: 50.6) so we discussed logic of program now let’s write program

you have to take array of integer “marks” to store marks of 6 subjects one another integer variable “total”  to store addition of marks and one Float variable “percentage” to store result of calculation

you have to use “for” loop to store marks in array & for performing addition of 6 subject’s marks because marks are stored in form of array

after performing addition you get addition of 6 subjects multiply it with 100 and divide by 600 (here you have to take 600 cause total subjects are 6 one subject containing total 100 marks so 600 ) that’s all you’ll got your percentage

Now store the result in float variable percentage and print it on console window using System.out.println(); 

program is given below follow it for reference

if you like the the way of explanation tell us in comment section you can also write the queries about this program we are defiantly going reply

share this post with your college friends so everyone can get benefit of it

Program As per GTU Syllabus

 

OUTPUT :
oopj practical 2

You May Also Like

About the Author: TheCoder

Leave a Reply

Your email address will not be published. Required fields are marked *