Specifically I can suggest the following solution to the problem stated:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ch4ExQ7
{
class Program
{
static void Main(string[] args)
Console.Write("How many numbers to sum?: ");
int num = int.Parse(Console.ReadLine());
int sum = 0;
bool parseTry = false;
Console.WriteLine("Enter your numbers: ");
{
int num_count = 0;
for (int i = 1; i <= num; i++)
{
parseTry = false;
do {
string str = Console.ReadLine();
parseTry = Int32.TryParse(str, out int parsed);
if (parseTry == true)
{
sum += parsed; num_count++;
}
else
{
Console.WriteLine("Enter only integers.");
}
}while(parseTry == false);
}
if (num_count >= 3)
{
Console.WriteLine("Your sum is: " + sum);
}
}
}
}
Normally, your code was missing one more loop executed until you've entered a valid parsable value for each of those three numbers.