Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
DKR.doc
Скачиваний:
5
Добавлен:
25.08.2019
Размер:
104.45 Кб
Скачать

2 вариант

Решение:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication65

{

public class Run

{

double q, xq, e = 2.71,fx,s;

int i, x;

public Run()

{

Console.WriteLine("первый параметр-q(для определения функции)\nвторой-количество шагов\nтретий-n");

this.q = Convert.ToInt32(Console.ReadLine());

this.i = Convert.ToInt32(Console.ReadLine());

this.x = Convert.ToInt32(Console.ReadLine());

}

public double F(double x)

{

this.xq = x * this.q;

if (Math.Abs(this.xq) < 10) { this.fx = Math.Pow(this.e, this.x + this.q);}

if (Math.Abs(this.xq) == 10) { this.fx = this.x + this.q;}

return fx;

}

public void end()

{

for (int g =this.x; g < this.i; g++)

{

s += F(g);

}

Console.WriteLine(this.s);

}

}

class Program

{

static void Main(string[] args)

{

Run a = new Run();

a.end();

Console.ReadLine();

}

}

}

17Вариант

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication1

{ class Массив

{ int[] a=new int [100];

int i,k=0,sum=0;

public void Ввод()

{ Random rnd = new Random();

for (i = 0; i < 100; i++)

{ a[i] = rnd.Next(15)-6;

Console.Write(a[i] + "\t"); } }

public void Poisk()

{ for (i = 0; i < 100; i++)

{ if (a[i] < 0) k++;

if ((i+1) % 2 == 0) sum += a[i]; }

Console.WriteLine(); }

public void Vivod()

{ Console.WriteLine("Количество отрицательных элементов = " + k);

Console.WriteLine("Сумма элементов стоящих на четных местах = " + sum); } }

class Program

{ static void Main(string[] args)

{ Массив ad = new Массив();

ad.Ввод();

ad.Poisk();

ad.Vivod();

Console.ReadLine(); } }}

24Вариант

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication1

{ class Massiv

{ double [] b; int[,] a;

int m, n;

public Massiv(int m, int n)

{ this.m = m; this.n = n;

this.a = new int[m,n]; this.b = new double[m]; }

public void Vvod()

{ for (int i = 0; i < m; i++)

for (int j = 0; j < n; j++)

{ Console.Write("Введите элемент " +(i +1)+ "," + (j+1)+" : \t");

a[i,j] = Convert.ToInt32(Console.ReadLine());} }

public void Sred()

{ for (int i = 0; i < m; i++)

{ for (int j = 0; j < n; j++)

{ b[i] += a[i, j]; } b[i] = b[i] / n; }}

public void Vivod()

{ for (int i = 0; i < m; i++)

Console.Write(b[i]+"\t"); } }

class Program

{ static void Main(string[] args)

{ Console.Write("Введите m: ");

int x = Convert.ToInt32(Console.ReadLine());

Console.Write("Введите n: ");

int y = Convert.ToInt32(Console.ReadLine());

Console.WriteLine();

Console.WriteLine("Введите массив: ");

Massiv qwer = new Massiv(x,y);

qwer.Vvod();

Console.WriteLine("Массив средних значений строк: ");

qwer.Sred();

qwer.Vivod();

Console.ReadLine(); } }}

8Вариант

namespace ConsoleApplication1

{

class OO

{

int x, y,z;

public OO(int x, int y,int z)

{

this.x = x;

this.y = y;

this.z = z;

}

int Min(int x, int y)

{

if (x < y) return x;

return y;

}

int Max(int x, int y)

{

if (x > y) return x;

return y;

}

public double P()

{

double p = Math.Abs(Min((int)(5*Math.Pow(x,2)),y)-Max(y,z)) / 2;

return p;

}

}

class Program

{

static void Main(string[] args)

{

}

}

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]