fork(2) download
  1. using System;
  2.  
  3. namespace ConsoleApp7
  4. {
  5. class Program
  6. {
  7. static void Main()
  8. {
  9.  
  10. int a = 0, b = 0, c = 0;
  11. string line = null;
  12.  
  13. for (int i = 0; i < 100; i++)
  14. {
  15. line = Console.ReadLine();
  16. if (line != null)
  17. {
  18.  
  19.  
  20.  
  21. a = Convert.ToInt32(line[2]) - 48;
  22. b = Convert.ToInt32(line[4]) - 48;
  23.  
  24.  
  25.  
  26.  
  27.  
  28. if (line[0] == '+')
  29. {
  30.  
  31. c = a + b;
  32. Console.WriteLine(c);
  33.  
  34. }
  35. if (line[0] == '-')
  36. {
  37. c = a - b;
  38. Console.WriteLine(c);
  39. }
  40. if (line[0] == '*')
  41. {
  42. c = a * b;
  43. Console.WriteLine(c);
  44. }
  45. if (line[0] == '/')
  46. {
  47. c = a / b;
  48. Console.WriteLine(c);
  49. }
  50. if (line[0] == '%')
  51. {
  52. c = a % b;
  53. Console.WriteLine(c);
  54. }
  55.  
  56. }
  57. else return;
  58.  
  59. }
  60. }
  61. }
  62. }
  63.  
Success #stdin #stdout 0.02s 16048KB
stdin
+ 7 9
- 0 4
* 5 6
/ 8 3
% 5 2
stdout
16
-4
30
2
1