Advertisements
Advertisements
प्रश्न
An ICSE school displays a notice on the school notice board regarding admission in Class XI for choosing stream according to marks obtained in English, Maths and Science in Class 10 Council Examination.
| Marks obtained in different subjects | Stream |
| Eng, Maths and Science >= 80% | Pure Science |
| Eng and Science >= 80%, Maths >= 60% | Bio. Science |
| Eng, Maths and Science >= 60% | Commerce |
Print the appropriate stream allotted to a candidate. Write a program to accept marks in English, Maths and Science from the console.
कोड लेखन
Advertisements
उत्तर
import java.util.*;
public class Q6
{ public static void main(String args[])
{ int e, m, s; // eng, maths, sci marks
Scanner ob = new Scanner(System.in);
System.out.println("Enter English Mark:");
e = ob.nextInt(); .
System.out.println("Enter Math Mark:");
m = ob.nextInt();
System.out.println("Enter Science Mark:");
s = ob.nextInt();
System.out.print("Stream Allotted:");
if (e >= 80 && m >= 80 && s >= 80) System.out.print("Pure Science");
else if (e >= 80 && m >= 60 && s >= 80) System.out.print("Bio Science");
else if (e >= 60 && m >= 60 && s >= 60) System.out.print("Commerce");
}}shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
