Advertisement
Vladimir76

задача 10

Jan 6th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace InputExit_zad10
  7. {
  8.     class InputZad10
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.Write("enter nomber : ");
  13.             int a = int.Parse(Console.ReadLine());
  14.             int sum;
  15.             Console.WriteLine("Do you want to enter a new number.");
  16.             Console.Write("If you want, press '1', if not-another number :");
  17.             int choice = int.Parse(Console.ReadLine());
  18.  
  19.          
  20.                 while (choice == 1)
  21.                 {
  22.                     Console.Write("enter nomber: ");
  23.                     int b = int.Parse(Console.ReadLine());
  24.                     a += b;
  25.                     sum = a;
  26.                     Console.WriteLine();
  27.                     Console.WriteLine("sum = " + sum);
  28.                     Console.WriteLine();
  29.                     Console.WriteLine("Do you want to enter a new number.");
  30.                     Console.Write("If you want, press '1', if not-another number :");
  31.                     choice = int.Parse(Console.ReadLine());
  32.                 }
  33.                 sum = a;
  34.                 Console.WriteLine("sum =" + sum);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement