Percent means percent (hundreds), i.e., a ratio of the parts out of 100. The symbol of a percent is %. We generally count the percentage of marks obtained, return on investment etc. The percentage can go beyond 100% also.
For Example, assuming that we have total and a part. So we say what part is what percent of total and should be calculated as :
percentage = ( part / total ) × 100
Algorithm
- 1. Collect values for part and total
- 2. Apply formula { percentage = ( part / total ) × 100 }
- 3. Display percentage
To calculate average and percentage marks of a students, you have to ask to the user to enter marks obtained in some subjects (say 5). Place summation of 5 subject's marks in a variable say sum and place sum/5 in a variable say avg then place sum/500*100 in a variable say perc, then display the result on the output screen.
File Name - Marks.java
Output -
0 comments: