Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class SumOfFiveNumbers
- {
- static void Main()
- {
- Console.Write("Please input 5 numbers, separated by space: ");
- string[] userInput = Console.ReadLine().Split();
- double[] numbers = new double[5];
- double sum = 0;
- for (int i = 0; i < 5; i++)
- {
- numbers[i] = double.Parse(userInput[i]);
- sum += numbers[i];
- }
- Console.WriteLine("sum is: " + sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement