I'm trying to get the maximum temperature and the day it occur from the value I put in. But the Max is always the last value i put in and the day is always 8 :( Can anyone see what is wrong with the code? Thanks in advance.
#include<stdio.h>
int main()
{
int i; int Day[7]; int Temp;
for(i=1; i<=7; i++)
{
printf("Enter Temp: ");
scanf("%d", &Temp);
Day[i] = Temp;
}
for(i=1; i<=7; i++)
{
int Max;
if(Max<Day[i])
{
Max = Day[i];
}
}
printf("Maximum temperature is %d on day %d", Max, i);
system("pause");
return 0;
}