Advertisement
Spocoman

05. Add and Subtract

Jan 26th, 2022
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace AddAndSubtract
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n1 = int.Parse(Console.ReadLine());
  10.             int n2 = int.Parse(Console.ReadLine());
  11.             int n3 = int.Parse(Console.ReadLine());
  12.            
  13.             int sum = Sum(n1, n2);
  14.             Console.WriteLine(Sum(n1, n2));
  15.             Console.WriteLine(Subtract(sum, n3));
  16.         }
  17.  
  18.         static int Sum(int n1, int n2)
  19.         {
  20.             return n1 + n2;
  21.         }
  22.  
  23.         static int Subtract(int sum, int n3)
  24.         {
  25.             return sum -= n3;
  26.         }
  27.  
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement