Файл: Отчет по лабораторной работе 1 на тему.docx

ВУЗ: Не указан

Категория: Отчет по практике

Дисциплина: Не указана

Добавлен: 11.12.2023

Просмотров: 38

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Задача 3





























































































Задача 4





#include

#include

using namespace std;

int main()

{

double K,N;

cout << "Введите K(число которое будет повторяться)" << "\n";

cin >> K;

cout << "Введите N(сколько раз число K будет повторяться)" << "\n";

cin >> N;

short i = 1;

while (i <= N)

{

cout << K << "\n";

i = i + 1;

}

return 0;

}





#include

#include

using namespace std;

int main()

{

double A,B;

cout << "Введите A - крайняя левая координата" << endl;

cin >> A;

cout << "Введите B - крайняя правая координата" << endl;

cin >> B;

short i = 1;

for (i = A; i <= B; i++)

{

cout << "i " << i << endl;


}

cout << "Количество операций = " << B - A << endl;

return 0;
}







#include

#include

using namespace std;

int main()

{

double A,B;

cout << "Введите A - крайняя левая координата" << endl;

cin >> A;

cout << "Введите B - крайняя правая координата" << endl;

cin >> B;

short i = 1;

for (i = A; i <= B; i++)

{

cout << "i " << i << endl;

}

cout << "Количество операций = " << B - A << endl;

return 0;

}





#include

#include

using namespace std;

int main()

{

double A,S;

int B;

cout << "Введите кол-во повторений" << "\n";

A = 20.4;

S = 0;

cin >> B;

for (short i = 1;i<=B; i++)

{

S = S + A;

cout << "количество " << i << "=" << S << "\n";

}

return 0;

}





#include

#include

using namespace std;

int main()

{

double A, B, N;

cout << "С какого числа возводить в степень" << endl;

cin >> A;

cout << "До какого числа возводить в степень" << endl;

cin >> B;

cout << "Шаг который делать между числами" << endl;

cin >> N;

for (short i = A + 1; i < B; i+= N)

{

cout << "i " << pow(i,2) << endl;

}

return 0;

}





#include

#include

using namespace std;

int main()

{

double A, B, H;

cout << "Введите точку отсчета координат" << endl;

cin >> A;

cout << "Введите точку конца координат" << endl;

cin >> B;

cout << "Введите шаг с которым будет вычисляться координаты" << endl;

cin >> H;

for (double i = B - 1; i > 0; i = i - H)

{

cout << "i " << i << endl;

}

return 0;
}





#include

#include

using namespace std;

int main()

{

int i, a, b, k, h,sum;

cout << "Введите 2 числа A < B" << endl;

cout << "Введите A" << endl;

cin >> a;

cout << "Введите B" << endl;

cin >> b;

sum = 0;

for (i = a; i <= b; i++)

{

sum = sum + i;

}

cout << "сумма целых чисел = " << sum << endl;

return 0;
}





#include

#include

using namespace std;

int main()

{

int i, a, b, k, h,sum;

cout << "Введите 2 числа A < B" << endl;

cout << "Введите A" << endl;

cin >> a;

cout << "Введите B" << endl;

cin >> b;

k = 1;

for (i = a; i <= b; i++)

{

k = k * i;

}

cout << "произведение целых чисел = " << k << endl;

return 0;

}





#include

#include

using namespace std;

int main()

{

int i, a, b, k, h,sum;

cout << "Введите 2 числа A < B" << endl;

cout << "Введите A" << endl;

cin >> a;

cout << "Введите B" << endl;

cin >> b;

sum = 0;

for (i = a; i <= b; i++)

{

sum = sum + pow(i,2);

}

cout << "сумма квадратов = " << sum << endl;

return 0;

}





#include

#include

using namespace std;

int main()

{

double n,a;

cout << "Сколько киллограмм конфет" << endl;

cin >> n;

a = 90;

for (double i = 1; i < n; i+=0.2)

{

cout << i <<" кг конфет, стоит"<< i*a << endl;

}

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int i, a, b, k, h, sum,N;

cout << "Введите N" << endl;

cin >> N;

sum = 0;

for (i = 1; i <= N; i++)

{

sum = sum + i;

a = sum * (2 * N - 1);

}

cout << "sqrt(N) = " << a << endl;

return 0;

}






#include

using namespace std;

int main(){

float B,A;

int N = 0;

cout << "Ввести степень N" << endl;

cin >> N;

cout << "Число которое будут возводить" << endl;

cin >> A;

B = A;

for( int i = 1; i <= N; i++, A *= B )

cout<<"i = "<
return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n;

double k;

cout << "n=" << endl;

cin >> n;

k = int(sqrt(n));

cout << "k=" << k << endl;

return 0;















Задача 5





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n,j;

double s;

cout << "Введите N" << endl;

cin >> n;

s = 0;

for (j = 1; j <= n; j++)

{

s = s + (1 / pow(2, j));

}

cout << "sum = 1/2^j + ... + 1/2^n = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n,j,x;

double s;

cout << "Введите N ,x" << endl;

cin >> n;

cin >> x;

s = cos(x);

for (j = 2; j <= n; j++)

{

s = s+(pow(cos(x),j))/j;

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n,j;

double s;

cout << "Введите N " << endl;

cin >> n;

s = 1-3;

for (j = 1; j <= n; j++)

{

if (j % 2 == 0)

s = s + pow(3, j);

else

s = s-pow(3,j);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j;

double s;

cout << "Введите N" << endl;

cin >> n;

s = 0;

for (j = 1; j <= n; j+=1)

{

s = s + (1 / sin(j));

}

cout << "s= = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j;

double s;

cout << "Введите N " << endl;

cin >> n;

s = 1 - 3;

for (j = 1; j <= n; j++)

{

if (j % 2 == 0)

s = s + pow(j, 3);

else

s = s - pow(j, 3);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j;

double s;

cout << "Введите N " << endl;

cin >> n;

s = 1 - 3;

for (j = 1; j <= n; j++)

{

if (j % 2 == 0)

s = s + cos(j);

else

s = s - cos(j);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j, x;

double s;

cout << "Введите N ,x" << endl;

cin >> n;

cin >> x;

s = 1-3;

for (j = 2; j <= n; j++)

{

if (j % 2 == 0)

s = s + pow(x, j)/j;

else

s = s - pow(x, j)/j;

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n,j,i,f;

double s;

cout << "Введите N " << endl;

cin >> n;

s = 0;

for (j = 1; j <= n; j++)

{

f = 0;

for (i = 1; i <= j; i++)

{

f = f + i;

}

if (j % 2 == 0)

s = s - f;

else

s = s+ f;

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, i,s,x;

cout << "Введите N " << endl;

cin >> n;

cout << "Введите x" << endl;

cin >> x;

for (i = 1; i <= n; i+=1)

{

s = sin(x) + sin(pow(x, i));

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j,i;

double s,f;

cout << "Введите N " << endl;

cin >> n;

s = 1;

for (j = 1; j <= n; j++)

{

f = 0;

for (i = 1; i <= j; i++)

{

f = f + i;

}

s = s + (1/f);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n,i;

double s;

cout << "Введите N " << endl;

cin >> n;

s = pow(n,2);

for (i = 1; i <= n; i++)

{

s = s + pow((n + i), 2);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j, i, f;

double s;

cout << "Введите N " << endl;

cin >> n;

s = 0;

for (j = 1; j <= n; j++)

{

f = 0;

for (i = 1; i <= j; i++)

{

f = f + i;

}

s = s + f;

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j, i,x;

double s, f;

cout << "Введите N,x " << endl;

cin >> n >> x;

s = 1;

for (j = 1; j <= n; j++)

{

f = 0;

for (i = 1; i <= j; i++)

{

f = f + i;

}

s = 1 + x + (pow(x,2) / f);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

int n, j, i, f, x;

double s;

cout << "Введите N " << endl;

cin >> n;

cout << "Введите x" << endl;

cin >> x;

s = 0;

for (j = 1; j <= n; j++)

{

f = 0;

for(i =1; i<= j; i++)

{

f= f+i;

}

if (j % 2 == 0)

s = s + pow(x,f);

else

s = s - pow(x,f);

}

cout << "s = " << s;

return 0;

}





#include

#include

#include

#include

using namespace std;

int main()

{

setlocale(LC_ALL, "Russian");

double x,n,i;

int result=0;

bool flag = true;

cout << "Введите N " << endl;

cin >> n;

cout << "Введите x" << endl;

cin >> x;

for (i = 1; i <= n; i+=2)

{

if (flag)

{

result += pow(x, i) / i;

flag = !flag;

}

else {

result -= pow(x, i) / i;

flag = !flag;

}

}

cout << "result = " << result;

return 0;

}