Advertisement
meta1211

Untitled

Apr 9th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Rextester
  4. {
  5.    
  6.     public class Program
  7.     {
  8.         public static  void PrintSumOf(int a, int b)
  9.         {
  10.             int sum = a + b;
  11.             Console.WriteLine("Sum of " + a + " and " + b + " is " + sum);
  12.         }
  13.         public static void Main(string[] args)
  14.         {
  15.             PrintSumOf(1, 2);
  16.             PrintSumOf(12, 59);
  17.             //А так бы пришлось писать
  18.             int a1 = 1;
  19.             int b1 = 2;
  20.             int a2 = 12;
  21.             int b2 = 59;
  22.             int sum1 = a1 + b1;
  23.             Console.WriteLine("Sum of " + a1 + " and " + b1 + " is " + sum1);
  24.             int sum2 = a2 + b2;
  25.             Console.WriteLine("Sum of " + a2 + " and " + b2 + " is " + sum2);
  26.            
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement