Essays.club - Получите бесплатные рефераты, курсовые работы и научные статьи
Поиск

Контрольная работа по "Программированию"

Автор:   •  Май 5, 2019  •  Контрольная работа  •  498 Слов (2 Страниц)  •  269 Просмотры

Страница 1 из 2

13

#include "stdafx.h"

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

setlocale(LC_ALL, "Rus");

double L;

cout << "Введите длину маятника:";

cin >> L;

const double g = 9.8;

const double Pi = 3.14;

double T = 2.0*Pi*sqrt(L / g);

cout << "Период равен " << T << endl;

system("pause");

}

1.

#include <iostream.h>

#include <conio.h>

void prost (int );

int main ()

{

int x = 1;

// ocnovnaya prog

while (x<100 || x>999){

cout <<"vvedite trehznachnoe chislo";

cin >> x;

}

prost(x);

getch();

return 0;

}

void prost(int ch){

int s, sum = 0;

cout <<"Prostuye chisla: 1\t";

int usl = ch/2;

int usl_2;

for (int y=2; y<usl; y++) {

s=0;

usl_2 = y;

for (int j=1; j<usl_2; j++)

if (y % j == 0) s++;

if (s==1 && ch % y == 0) {

cout <<y<<"\t";

sum += y;

}

}

cout <<"\nSumma = "<<sum+1;

}

2.#include <iostream>

#include <locale.h>

using namespace std;

int main()

{

int number;

setlocale(LC_CTYPE,"Russian");

cout << "Введите число: ";

cin >> number;

cin.ignore();

cout << "Вы ввели: "<< number <<"\n";

cin.get();

}

3.#include

...

Скачать:   txt (2.7 Kb)   pdf (37.9 Kb)   docx (9.4 Kb)  
Продолжить читать еще 1 страницу »
Доступно только на Essays.club