Open akmalrashd opened 1 year ago
import java.util.Scanner;
public class Day33
{
public static void main (String [] args)
{
Scanner akmal = new Scanner(System.in);
System.out.print("Enter number of Days : ");
int tDays = akmal.nextInt();
double temperature [] = new double [tDays];
double maxTemp = -100;
for ( int i= 0 ; i < tDays ; i++)
{
System.out.print( "Enter Temperature of day "+ (i+1) + " (Celcius) : ");
temperature [i] = akmal.nextDouble();
if (temperature [i] > maxTemp)
maxTemp = temperature[i];
}
System.out .print("Maxi mum Temperature in "+ tDays + " Days (Celcius) : " + maxTemp);
}
}
Given a list of daily temperatures for a certain number of days, design an algorithm to determine the maximum temperature. The first input is the number of days.