I am working on the puzzle temperature. I am a fairly inexperienced to programming and have been working on this easy puzzle for 3 days now. I’ve gotten passed all the challenges aside from the 5th challenge if anyone can give me tip or hints (no outright solutions please) that would be very helpful.
thank you.
code:
class Solution
{
static void Main(string[] args)
{
int temp = 0;
int t = 0;
int f = 0;
int n = int.Parse(Console.ReadLine()); // the number of temperatures to analyze
string[] inputs = Console.ReadLine().Split(' ');
for (int i = 0; i < (n-1); i++)
{
t = int.Parse(inputs[i]);// a temperature expressed as an integer ranging from -273 to 5526
f = int.Parse(inputs[i+1]);
temp = int.Parse(inputs[0]);
if (Math.Abs(t) < Math.Abs(f)){
if (Math.Abs(temp) > Math.Abs(t)){
temp = t;
}
}
}
int tempo = Math.Abs(temp);
string grr = tempo.ToString(); //I got frustrated and called it grr
if (inputs.Contains(grr) ){
temp = Math.Abs(temp);
}
Console.WriteLine(temp);
// Write an answer using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
}
}