Skip to content

Commit 6e5b5ad

Browse files
Exercise 1 Solution
1 parent 8f5c859 commit 6e5b5ad

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

11.Exercise_1_Solution/README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Java Tutorial: Exercise 1 - Solutions + Shoutouts
2+
- Write a program to calculate the percentage of a given student in the CBSE board exam. His marks from 5 subjects must be taken as input from the keyboard. (Marks are out of 100)
3+
4+
## Code Solution:
5+
```
6+
package com.company;
7+
import java.util.Scanner;
8+
9+
public class cwh_11_ex1_sol {
10+
11+
12+
public static void main(String[] args) {
13+
14+
Scanner scan = new Scanner(System.in);
15+
System.out.println("Enter your Physics marks : ");
16+
int physics = scan.nextInt();
17+
System.out.println("Enter your English marks : ");
18+
int English = scan.nextInt();
19+
System.out.println("Enter your Chemistry marks : ");
20+
int chemistry = scan.nextInt();
21+
System.out.println("Enter your Mathematics marks : ");
22+
int mathematics = scan.nextInt();
23+
System.out.println("Enter your Computer Science marks : ");
24+
int computer = scan.nextInt();
25+
26+
float percentage = ((physics + English + chemistry + mathematics + computer)/500.0f)*100;
27+
28+
System.out.println("percentage : ");
29+
System.out.println(percentage);
30+
31+
32+
}
33+
}
34+
```
35+
36+
### Ultimate Java Cheatsheet: [Click To Download](https://api.codewithharry.com/media/videoSeriesFiles/courseFiles/java-tutorials-for-beginners-11/UltimateJavaCheatSheet.pdf)

0 commit comments

Comments
 (0)