Что выведится в фрагменьте s: 0; a: =1; while a< 2do begin s: =s+a; a: =a+0.5; writeln(a: 5: 2,s: 5: 2)end;
142
279
Ответы на вопрос:
Если ты переписал фрагмент правильно, то: 1.50 1.00 2.00 2.50 если end расположен перед writeln, то тогда ответ 2.00 2.50
#1: #include < iostream> #include < ctime> int main() { srand(time(null)); const int arraysize = 10; int mainarray[arraysize]; for (int i = 0; i < arraysize; i++) mainarray[i] = rand() % 1000; int maxnum = mainarray[0]; for (int i = 0; i < arraysize; i++) if (mainarray[i] > maxnum) maxnum = array[i]; std: : cout < < maxnum < < std: : endl; system("pause"); return 0; } #2: #include < iostream> #include < cmath> using namespace std; int main() { float a_coef, b_coef, c_coef; cout < < "input the coefficients (a * x^2 + b * x + c): "; cin > > a_coef > > b_coef > > c_coef; float res1, res2; res1 = (-b_coef + sqrt(b_coef * b_coef - 4 * a_coef * c_coef)) / (2 * a_coef); res2 = (-b_coef - sqrt(b_coef * b_coef - 4 * a_coef * c_coef)) / (2 * a_coef); cout < < res1 < < "; " < < res2 < < endl; system("pause"); return 0; } #3: #include < iostream> #include < ctime> int main() { srand(time(null)); int unknownnumber = rand() % 100 - 50, attempts = 0, inputtednumber; while (true) { attempts++; cout < < "input the number: "; cin > > inputtednumber; if (inputtednumber ! = unknownnumber) cout < < "incorrect answer! try again! " < < endl; else break; } cout < < "attempts: " < < attempts; system("pause"); return 0; }
Популярно: Информатика
-
клинт29.08.2020 04:21
-
куллллл29.01.2023 07:04
-
Патич23220.11.2022 22:14
-
KatyLala18.05.2020 00:30
-
valeria20456713.08.2021 01:00
-
Sosushka29.03.2020 10:53
-
aaaaaaggghhh08.06.2020 02:05
-
марс5503.07.2022 16:26
-
20Bella0431.07.2021 23:11
-
petrosuanyulian23.03.2022 15:11