TOPIC
Runtime error
ggeorge0 asked 4 years ago
O script está correto, porém apresenta Runtime error. A lógica e a escrita estão certa porém em C#
using System;
namespace uri1149SomandoInteirosConsecutivos { class Program { static void Main(string[] args) { int i, a, n, soma = 0;
string[] valores = Console.ReadLine().Split(' ');
a = int.Parse(valores[0]);
n = int.Parse(valores[1]);
while (n <= 0)
{
valores = Console.ReadLine().Split(' ');
n = int.Parse(valores[1]);
}
for (i = 0; i < n; i++)
{
soma += a + i;
}
Console.WriteLine(soma);
}
}
}
This topic has not been answered yet. Be the first!