Help me write a program that enters a number n and after that enters more n numbers (based on the first n number) and calculates and prints their sum. Maybe with a for-loop?
Yes - indeed - the solution is with for loop.
See the 15th line - to view the view the sum of the numbers on one single line - the Console.WriteLine is OUTSIDE the for loop!
static void Main()
int n = int.Parse(Console.ReadLine());
double sumOfNumbers = 0;
for (int i = 0; i < n; i++)
double num = double.Parse(Console.ReadLine());
sumOfNumbers += num;