Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class SumOfFiveNumbers
- {
- static void Main()
- {
- System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
- decimal number;
- decimal sum = 0;
- string input;
- for (int i = 1; i <= 5; i++)
- {
- do
- {
- input = Console.ReadLine();
- }
- while (!decimal.TryParse(input, out number));
- sum += number;
- }
- Console.WriteLine("The sum is: {0} ", sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement