kuruku

SumOfIntegers

Apr 19th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. using System;
  2.  
  3. //Write a program that reads 3 integer numbers from the console and prints their sum. Examples:
  4.  
  5. class SumOfIntegers
  6. {
  7.     static void Main()
  8.     {
  9.         double sum = 0;
  10.         for (int i = 0; i < 3; i++)
  11.         {
  12.             Console.Write("{0}). Number = ", i+1);
  13.             double n = double.Parse(Console.ReadLine());
  14.             sum += n;
  15.         }
  16.         Console.Write("Sum = ");
  17.         Console.WriteLine(sum);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment