GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Java-Work/Question20.java at master · Animesh-Ghosh/Java-Work

Expand file tree

/

Question20.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
33 lines (31 loc) · 1.03 KB
/

Question20.java

Copy path

File metadata and controls

33 lines (31 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
33
import java.util.Scanner;
/* program to enter marks of N students and compute sum and average of marks
and to find the largest and smallest marks entered */
class Question20 {
public static void main (String[] args) {
Scanner input = new Scanner (System.in);
int n;
float[] marks;
float sum, avg, largest, smallest;
System.out.print ("Enter number of students: ");
n = input.nextInt ();
marks = new float[n];
System.out.print ("Enter marks of student 1: ");
marks[0] = input.nextFloat ();
largest = marks[0];
smallest = marks[0];
sum = marks[0];
for (int i = 1; i < n; i++) {
System.out.print ("Enter marks of student " + (i + 1) + ": ");
marks[i] = input.nextFloat ();
if (marks[i] > largest) largest = marks[i];
if (marks[i] < smallest) smallest = marks[i];
sum += marks[i];
}
avg = sum / n;
System.out.println ("Sum of marks = " + sum);
System.out.println ("Average of marks = " + avg);
System.out.println ("Maximum marks = " + largest);
System.out.println ("Minimum marks = " + smallest);
}
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.