VelizarAvramov

Add two numbers

Jul 17th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. Write a program, which reads 2 whole numbers and adds them together. Then, print them in the following format:“a + b = sum”
  2. using System;
  3.  
  4. namespace _02._Add_Two_Numbers
  5. {
  6.     class AddTwoNumbers
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int a = int.Parse(Console.ReadLine());
  11.             int b = int.Parse(Console.ReadLine());
  12.  
  13.             int sum = a + b;
  14.             Console.WriteLine("{0} + {1} = {2}", a, b, sum);
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment