Guest User

Untitled

a guest
Feb 27th, 2020
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace HW1
  4. {
  5. class Program
  6. {
  7. static double Function(double a)
  8. {
  9. return 1 - Math.Sin(a);
  10. }
  11. static void Main(string[] args)
  12. {
  13. /*
  14. //1
  15. int a = int.Parse(Console.ReadLine());
  16. int b = int.Parse(Console.ReadLine());
  17. int c = int.Parse(Console.ReadLine());
  18. if ((a + b > c) && (a + c > b) && (b + c > a)) Console.WriteLine("True");
  19. else Console.WriteLine("False");
  20. //2
  21. int d = int.Parse(Console.ReadLine());
  22. if ((d > 9) && (d < 100) && (d % 2 == 0)) Console.WriteLine("True");
  23. else Console.WriteLine("False");
  24. //3
  25. Console.Write("Четырёх-значное число:");
  26. int e = int.Parse(Console.ReadLine());
  27. int e1 = e;
  28. int f = 0;
  29. while (e1 != 0)
  30. {
  31. f = f * 10 + e1 % 10;
  32. e1 /= 10;
  33. }
  34. Console.WriteLine(f);
  35. if (f == e) Console.WriteLine("True");
  36. else Console.WriteLine("False");
  37. //4
  38. double x = Convert.ToDouble(Console.ReadLine());
  39. double y = Convert.ToDouble(Console.ReadLine());
  40. double p = Math.Sqrt(x * x + y * y);
  41. int z;
  42. if ((y >= 0) && (p >= 1) && (p <= 2)) z = 1;
  43. else z = 0;
  44. Console.Write("z=");
  45. Console.WriteLine(z);
  46. //5
  47. double x = Convert.ToDouble(Console.ReadLine());
  48. double y = Convert.ToDouble(Console.ReadLine());
  49. double p = Math.Sqrt(x * x + y * y);
  50. double z;
  51. if ((p <= 1) && (p >= 0) && (y >= 0) && (x <= 0) || (x >= 0) && (y >= 0) && (p >= 0.3) && (p <= 1)) z = 0;
  52. else z = y;
  53. Console.Write("z=");
  54. Console.WriteLine(z);
  55. //6
  56. double x = Convert.ToDouble(Console.ReadLine());
  57. double y = Convert.ToDouble(Console.ReadLine());
  58. double p = Math.Sqrt(x * x + y * y);
  59. double z;
  60. if ((y >= Math.Abs(x)) && (p <= 1)) z = x + y;
  61. else z = x - y;
  62. Console.Write("z=");
  63. Console.WriteLine(z);
  64. //7
  65. double x = Convert.ToDouble(Console.ReadLine());
  66. double y = Convert.ToDouble(Console.ReadLine());
  67. double p = Math.Sqrt(x * x + y * y);
  68. double z;
  69. if ((y <= x / 2) && (p <= 1)) z = x;
  70. else z = y;
  71. Console.Write("z=");
  72. Console.WriteLine(z);
  73. //8
  74. Console.Write("Целое число > 1:");
  75. int n = Convert.ToInt32(Console.ReadLine());
  76. Console.Write("Вещественные числа a < b. a:");
  77. double a = Convert.ToDouble(Console.ReadLine());
  78. Console.Write("b:");
  79. double b = Convert.ToDouble(Console.ReadLine());
  80. double h = (b - a) / n;
  81. Console.Write("h = ");
  82. Console.WriteLine(h);
  83. for (int i = 0; i < n; i++) Console.WriteLine(a + i * h);
  84. Console.WriteLine(b);
  85. //9
  86. Console.Write("Целое число > 1:");
  87. int n = Convert.ToInt32(Console.ReadLine());
  88. Console.Write("Вещественные числа a < b. a:");
  89. double a = Convert.ToDouble(Console.ReadLine());
  90. Console.Write("b:");
  91. double b = Convert.ToDouble(Console.ReadLine());
  92. double h = (b - a) / n;
  93. Console.Write("h = ");
  94. Console.WriteLine(h);
  95. for (int i = 0; i < n; i++) Console.WriteLine(Program.Function(a + i * h));
  96. Console.WriteLine(Program.Function(b));
  97. //10
  98. double a; int n;
  99. a = Convert.ToDouble(Console.ReadLine());
  100. double a1 = a;
  101. n = Convert.ToInt32(Console.ReadLine());
  102. for (int i = 1; i < n; i++) a *= a1;
  103. Console.WriteLine(a);
  104. //11
  105. double s = 1000; double p; int k = 0;
  106. Console.Write("0<p<25, p = ");
  107. p = Convert.ToDouble(Console.ReadLine());
  108. while (s <= 1100)
  109. {
  110. s = s * (1 + p / 100);
  111. k++;
  112. }
  113. Console.WriteLine("Месяцы :" + k + ", Итоговая сумма :" + s);
  114. //12
  115. double a, b, c; int kol_kv;
  116. a = Convert.ToDouble(Console.ReadLine());
  117. b = Convert.ToDouble(Console.ReadLine());
  118. double b1 = b;
  119. c = Convert.ToDouble(Console.ReadLine());
  120. kol_kv = 0;
  121. while (c <= a)
  122. {
  123. while (c <= b1)
  124. {
  125. b1 -= c;
  126. kol_kv++;
  127. }
  128. a -= c;
  129. b1 = b;
  130. }
  131. Console.WriteLine("Кол-во квадратов :" + kol_kv);*/
  132. //13
  133. int a, b;
  134. Console.WriteLine("a < b");
  135. Console.Write("a = ");
  136. a = Convert.ToInt32(Console.ReadLine());
  137. Console.Write("b = ");
  138. b = Convert.ToInt32(Console.ReadLine());
  139. while(a <= b)
  140. {
  141. for(int i=0;i<a;i++)
  142. {
  143. Console.Write(a);
  144. }
  145. a++;
  146. Console.Write(" ");
  147. }
  148. }
  149. }
  150. }
RAW Paste Data