wingman007 icon

KrushkovTasks

wingman007 | PRO | 11/29/21 06:00:03 AM UTC (Edited) | 0 ⭐ | 1748 👁️ | Never ⏰ | []
C# |

3.58 KB

|

None

|

0 👍

/

0 👎

// ---------------------------------- Test 1 -2 II --------------------------------------
//using System;
 
//namespace MyPrograme
//{
//    public class Program {
//        static void Main(string[] args)
//        {
 
            double b = 2.3, y = 5.6, result;
 
            result = (b + Math.Pow(Math.Sin(Math.Pow(Math.PI, 4)), 2)) / (Math.Pow(Math.Cos(6), 1.0 / 5) + Math.Abs(1 / Math.Tan(y)));
 
            Console.WriteLine(result);
 
//        }
//    }
//}
 
 
// ------------------------- Test 1 - 1 I) -------------------------
 
double x = 1.1, y = 3.4, z = 4.5, result;
result = (Math.Pow(x, 7) * y * z - 3.3 * Math.Abs(x + Math.Pow(y, 1/4))) / Math.Pow(10, 7) + Math.Sqrt(Math.Log(4, Math.E));
Console.WriteLine(result);
 
--------------------------- 380 --------------------------
 
Console.Write("Please, enter k = ");
int k = int.Parse(Console.ReadLine());
int sum = 0;
int num;
do
{
    Console.Write("Please, enter an int number (0 for exit): ");
    num = int.Parse(Console.ReadLine());
    if (num % 2 == 1) sum += num;
} while (num != 0);
 
Console.Write(sum);
 
// ---------------------------- 404 -----------
 
using System;
 
namespace MyNamespace
{
    class Program
    {
        static void Main()
        {
            
            int k;
            do
            {
                Console.Write("Please, eneter the size of the array [2;50]: ");
                k = int.Parse(Console.ReadLine());
            } while (k < 2 || k > 50);
 
            int[] array = new int[k];
 
            for (int i = 0; i < array.Length; i++)
            {
                Console.Write("Please eneter element array[{0}] = ", i);
                array[i] = int.Parse(Console.ReadLine());
            }
 
            Console.WriteLine("The sum of the array elements > 40 is {0}", Sum(array, 40));
        }
 
        static int Sum(int[] array, int k)
        {
            int sum = 0;
 
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] > k)
                {
                    sum += array[i];
                }
            }
 
            return sum;
        }
    }
}
 
// ------------------------------ Task 83 ----------------------------
int max = 100;
for (int i = 1, j = 100; i < 51; i += 2, j -= 2)
{
    Console.Write("{0}, {1}, {2}, {3}, ", i, i + 1, j, j - 1);
}
 
// -------------------- 4 g ----------------------------
double x = 1.2, y = 3.4, z = 5.6, a = 6.7, b = 2.3, result;
result = Math.Pow((y + 6 * a - 2) / (3 * (x + 6)), 6) - (z / (z + 7 * b));
Console.WriteLine(result);
 
// ------------ 122 g ----------------------
 
using System;
 
namespace MyNamespace
{
    class Program
    {
        static void Main()
        {
 
            double x = 1.2, y = 1;
            for (int n = 0; n < 5; n++)
            {
                y += (Math.Pow(-1, n) * Math.Pow(x, 2 * n)) / Factorial(2 * n);
            }
 
            y = 1 - y;
 
            Console.WriteLine(y);
        }
 
        static int Factorial(int n)
        {
            int factorial = 1;
 
            for (int i = 1; i <= n; i++)
            {
                factorial += i;
            }
 
            return factorial;
        }
    }
}
 
// -------------------------  36 j --------------------------
int x = -2, y = -3, z = -4;
Console.WriteLine( (x < 0 && y < 0 && z < 0)? true : false);
 
// ------------------------ Task 12 --------------------------
Console.Write("Please, eneter a number with 7 digits: ");
int i = int.Parse(Console.ReadLine());
Console.WriteLine((i / 1000) % 10);
 

Comments