C# Loops. I need help with this question:
Write a program that reads 10 data from the keyboard and add only those that are negative.
I just started class in January an we're in C# loops. I haven't been in school for over 3 weeks now because of the coronavirus. So i'm kinda lost now and we just started online class so big rips to me:(
double sum = 0.0d;
double n = 0.0d;
for (int i = 1; i <= 10; i++)
{
Console.Write($"Enter a number {i}: ");
n = double.Parse(Console.ReadLine());
}
if (n < 0)
sum = n + n;
Console.WriteLine($"{sum}");
Here is my code (I'm probably 100% wrong but it's 2am rn and i'm trying);
Thanks! :)
Thank ya'll so much for the help!