0% found this document useful (0 votes)
0 views1 page

Import Java - Util.scanner

The Java program collects the names and marks of a specified number of students. It assigns grades based on the marks: 'A' for 90-100, 'B' for 80-89, 'C' for 70-79, and 'Fail' for below 70. Finally, it prints each student's name, grade, and marks.

Uploaded by

piyushthakur4495
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views1 page

Import Java - Util.scanner

The Java program collects the names and marks of a specified number of students. It assigns grades based on the marks: 'A' for 90-100, 'B' for 80-89, 'C' for 70-79, and 'Fail' for below 70. Finally, it prints each student's name, grade, and marks.

Uploaded by

piyushthakur4495
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;
class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);

System.out.print("enter no of students-");
int n=sc.nextInt();
sc.nextLine();

String name[]=new String[n];


int marks[]=new int[n];
String[] grade = new String[n];

for(int i=0;i<n;i++){
System.out.print("Enter name of student-");
name[i]=sc.nextLine();

System.out.print("Enter marks of student: ");


marks[i] = sc.nextInt();
sc.nextLine();

if(marks[i]>=90&&marks[i]<=100){
grade[i]="A";
}
else if(marks[i]>=80){
grade[i]="B";
} else if(marks[i]>=70){
grade[i]="C";
}
else{
grade[i]="Fail";
}
}
System.out.println("You entered-");
for(int i=0;i<n;i++){
System.out.println("The name is- "+name[i]+" ,Grade is- "+grade[i]+" ,Marks
are- "+marks[i]);
}

sc.close();
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy