Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace clase2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //vars to use
  14.             int a, b, c ,res;
  15.             Boolean ban ;
  16.  
  17.             //Default values
  18.             a = 0;
  19.             b = 0;
  20.             c = 0;
  21.             ban = true;
  22.  
  23.             //Input
  24.             Console.WriteLine("digite dato 1");
  25.             a = int.Parse(Console.ReadLine());
  26.  
  27.             Console.WriteLine("digite dato 2");
  28.             b = int.Parse(Console.ReadLine());
  29.            
  30.             //Operation            
  31.             do
  32.             {
  33.                 Console.WriteLine("digite 1:SUM , 2:RESTA");
  34.                 res = int.Parse(Console.ReadLine());
  35.                 if(res == 1){
  36.                     c = a + b;
  37.                     ban = false;
  38.                 }else if(res == 2){
  39.                     c = a - b;
  40.                     ban = false;
  41.                 }              
  42.             } while (ban);
  43.  
  44.             //Output  
  45.             Console.Write("Resultado es : " + c);
  46.             Console.ReadLine();
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement