Есть ответ 👍

Информатика 9 класс Язык программирования: c++
|
|
с клавиатуры вводятся числа одно за другим. найти сумму всех вводимых чисел до тех пор, пока не встретится число большее 50​

273
392
Посмотреть ответы 2

Ответы на вопрос:


#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;

}

Объяснение:

Популярно: Информатика