package Assignments1;
import java.util.Scanner;
public class Q5
{
public static void main(String[] args)
{
{
int size;
Scanner reader = new Scanner(System.in);
System.out.println("Enter the size :");
size = reader.nextInt();
int [] grades = new int [size];
int sum = 0;
double average;
for(int i=0; i<grades.length; i++)
{
System.out.println("Enter the grades" +i +" :");
grades[i] = reader.nextInt();
sum=sum +grades[i];
}
System.out.println("The grades are : ");
for(int i=0; i<grades.length; i++)
{
System.out.print(grades[i] + "\t");
}
int maxValue = grades[0];
for(int i=1; i<grades.length; i++)
{
if(grades[i] > maxValue)
{
maxValue = grades[i];
}
}
System.out.println();
System.out.println("========================");
System.out.println("Maximum value :"+maxValue);
System.out.println("========================");
int minValue = grades[0];
for(int i=1; i<grades.length; i++)
{
if(grades[i] < minValue)
{
minValue = grades[i];
}
}
System.out.println("Minimum value : " +minValue);
System.out.println("==========================");
System.out.println("Total :" +sum);
average=sum / size;
System.out.println("Average value : " +average);
System.out.println("==========================");
}
}
}
markchua89 0 Newbie Poster
markchua89 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.