pupesko

SoftUni - 4.1 Sum of 3 Numbers

Sep 30th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Globalization;
  4.  
  5.  
  6. class SumOfNumes
  7. {
  8.      static void Main()
  9.     {
  10.     //Write a program that reads 3 real numbers from the console and prints their sum.
  11.  
  12.         Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
  13.         Console.Write("Enter the First number: ");
  14.         double a = double.Parse(Console.ReadLine());
  15.  
  16.         Console.Write("Enter the Second number: ");
  17.         double b = double.Parse(Console.ReadLine());
  18.  
  19.         Console.Write("Enter the Third number: ");
  20.         double c = double.Parse(Console.ReadLine());
  21.  
  22.         Console.WriteLine("The sum of these numbers is: " + "{0} + {1} + {2} = {3}", a, b, c, a + b + c);
  23.  
  24.      }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment