Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- using System.Globalization;
- namespace _01.SumOfNumbers
- {
- class SumOfNumbers
- {
- static void Main()
- {
- Console.Write("How many times would you like to sum numbers?: ");
- int examples = int.Parse(Console.ReadLine());
- double[] a = new double[examples];
- double[] b = new double[examples];
- double[] c = new double[examples];
- string[] sum = new string[examples];
- for (int i = 0; i < examples; i++)
- {
- System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- Console.Write("Enter your first number: ");
- a[i] = double.Parse(Console.ReadLine());
- Console.Write("Enter your second number: ");
- b[i] = double.Parse(Console.ReadLine());
- Console.Write("Enter your third number: ");
- c[i] = double.Parse(Console.ReadLine());
- sum[i] = Convert.ToString(a[i] + b[i] + c[i]);
- }
- Console.WriteLine("|{0,-8}|{1,-8}|{2,-8}|{3,-8}|", "Number a", "Number b", "Number c", "Sum");
- for (int i = 0; i < examples; i++)
- {
- Console.WriteLine("|{0,-8}|{1,-8}|{2,-8}|{3,-8}|", a[i], b[i], c[i], sum[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement