Advertisement
Kamigawa

Untitled

Oct 9th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. using System;
  2.  
  3. //Write a C# program to print on screen the result of adding, subtracting,
  4. //multiplying and dividing two numbers typed by the user.
  5. //The remainder of the division must be displayed, too.
  6. //It might look like this:
  7. //Enter a number: 12
  8. //Enter another number: 3
  9. //12 + 3 = 15
  10. //12 - 3 = 9
  11. //12 x 3 = 36
  12. //12 / 3 = 4
  13. //12 mod 3 = 0
  14. class SeveralOperations
  15. {
  16. static void Main()
  17. {
  18. int[] nums = new int[2];
  19. int sumary = 0;
  20. int substraction = 0;
  21. int multiply = 0;
  22. int? devision;
  23. int? modul;
  24. for (int i = 0; i < 2; i++)
  25. {
  26. Console.WriteLine("Enter number: ", i + 1);
  27. int number = int.Parse(Console.ReadLine());
  28. nums[i] = number;
  29. }
  30. sumary = nums[0] + nums[1];
  31. substraction = nums[0] - nums[1];
  32. multiply = nums[0] * nums[1];
  33. devision = nums[0] / nums[1];
  34. modul = nums[0] % nums[1];
  35.  
  36. Console.WriteLine("{0}\n{1}\n{2}\n{3}\n{4}\n", sumary, substraction, multiply, devision, modul);
  37.  
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement