Информатика 9 класс Язык программирования: c++
|
|
с клавиатуры вводятся числа одно за другим. найти сумму всех вводимых чисел до тех пор, пока не встретится число большее 50
273
392
Ответы на вопрос:
#include <iostream>
using namespace std;
int main() {
double sum = 0;
double temp = 0;
while (true){
cin >> temp;
if(temp > 50){
break;
}
sum +=temp;
}
cout << sum << endl;
return 0;
}
#include <iostream>
#include<vector>
using namespace std;
int square(int x){
for (int i = 1; i <= 45; ++i){
if (i * i <= x){
continue;
}
return (i - 1) * (i - 1);
}
}
int main()
{
int x, y, xwas, ywas, xywas;
cin >> x >> y;
xwas = square(x);
ywas = square(y);
xywas = square(x + y);
if (xwas + ywas < xywas){
cout << "Petya gives paint to Vasya";
}
else if (xwas + ywas == xywas){
cout << "Equal";
}
else {
cout << "Petya leaves paint to himself";
}
return 0;
}
Объяснение:
Популярно: Информатика
-
заря2427.10.2021 16:06
-
Женечка555119.03.2021 22:54
-
ddddddddddddddd1023.09.2021 18:21
-
svetaabc13.07.2020 21:31
-
впнекккккк26.03.2022 14:11
-
slia198421.02.2023 09:27
-
сергей107408.11.2022 11:47
-
M8922669113006.04.2020 07:00
-
GlebRyabov24.03.2023 11:03
-
aaaddd198801.04.2020 09:22