-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditional.java
More file actions
32 lines (25 loc) · 877 Bytes
/
Copy pathconditional.java
File metadata and controls
32 lines (25 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
public class conditional {
public static void main(String[]args)
{
//write a program to find out whether a student is pass or fail ,if the required total 40% and at least 33% in each subject to pass.
float sub1,sub2,sub3;
Float percentage;
Scanner sc=new Scanner (System.in);
System.out.println("Enter the sub1 marks:");
sub1=sc.nextFloat();
System.out.println("Enter the sub2 marks:");
sub2=sc.nextFloat();
System.out.println("Enter the sub3 marks:");
sub3=sc.nextFloat();
percentage=((sub1+sub2+sub3)/300)*100;
System.out.println("your percentage is :" + percentage);
if(percentage>=40 && sub1>33 && sub2>33 && sub3>33)
{
System.out.println("u are Pass");
}
else{
System.out.println("u failed");
}
}
}