
Seed
5 год назад
С++Посчитать функцию у=3*х – х2, если х кратно 3, и функцию у= 2*х-10, если х кратно 5. На промежутке от 5 до 50. Шаг +1. Вывести на печать Хi и Уi
ОТВЕТЫ

Elenka
Oct 24, 2020
#include<iostream>
using namespace std;
int main()
{
for(int i = 0; i < 40; i++)
cout <<"_";
cout <<"n";
for(int x = 5; x < 51; x++)
{
if (x % 3 == 0)
{
int y = x*(3-x);
cout <<"x = "<<x<<" y = "<<y;
if (x < 10) cout <<" ";
if (y > -1000)
{
cout <<" ";
if (y > -100)
{
cout <<" ";
if (y > -10) cout <<" ";
}
}
cout <<" ";
if (x % 5 != 0) cout <<"|n";
}
if (x % 5 == 0)
{
if (x % 3 != 0) cout <<" ";
int y = 2*(x-5);
cout <<"| x = "<<x<<" y = "<<y<<"n";
}
}
return 0;
}
using namespace std;
int main()
{
for(int i = 0; i < 40; i++)
cout <<"_";
cout <<"n";
for(int x = 5; x < 51; x++)
{
if (x % 3 == 0)
{
int y = x*(3-x);
cout <<"x = "<<x<<" y = "<<y;
if (x < 10) cout <<" ";
if (y > -1000)
{
cout <<" ";
if (y > -100)
{
cout <<" ";
if (y > -10) cout <<" ";
}
}
cout <<" ";
if (x % 5 != 0) cout <<"|n";
}
if (x % 5 == 0)
{
if (x % 3 != 0) cout <<" ";
int y = 2*(x-5);
cout <<"| x = "<<x<<" y = "<<y<<"n";
}
}
return 0;
}
230
Смежные вопросы: