Code Help

  • Thread starter Thread starter Extra Account
  • Start date Start date
E

Extra Account

Guest
Hello,

I was wondering how I would easily repeat the statement asking for the x & y coordinates 5 times (because the user can input up to 5 sets of coordinates (Because there are 5 suppliers)), instead of coping and pasting and having 10 variables.

Thanks in advance.



Code

using System;

namespace Program_2
{
class Program
{
static void Main(string[] args)
{
double x, y, z;
Console.WriteLine("Enter the number of suppliers:");
z = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the X-Coordinate for supplier 1:");
x = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the y-Coordinate for supplier 2:");
y = Convert.ToDouble(Console.ReadLine());
}
}
}

Continue reading...
 
Back
Top