MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI
UNIVERSITETI
Amaliy ish
Bajardi: 731-22 guruh talabasi
Abdullayev Avazbek
TOSHKENT 2023
C++ tilning shartli operatorlari va mantiqiy amallari
yordamida berilgan A(x,y) nuqtaning shtrihlangan sohaga tegishli yoki tegishli emasligini aniqlovchi dastur yozing.
#include
using namespace std;
int main()
{
float x, y;
cout << "x = ";
cin >> x;
cout << "y = ";
cin >> y;
if (y>=0 && -pow(x,2)+2>=y)
{
cout << "Tegishli" << endl;
}
else
{
cout << "Tegishli emas" << endl;
}
return main();
}
2-topshiriq. Ichma ich joylashgan takrorlash operatorlaridan foydalanib rasmda
ko’rsatilganlarni chop qiluvchi dastur tuzing
3
|
3 5 7 9
11 13 15 17
19 21 23 25
27 29 31 33
|
#include
using namespace std;
int main()
{
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
cout << i * 8 + j * 2 + 3 << " ";
}
cout << endl;
}
}
3-Topshiriq
3.
|
Berilgan sonni 4 darajasini topadigan funksiya yarating. Ushbu
funksiya yordanida a,b,c,d sonlarini 4 darajasini hisoblang
|
#include
using namespace std;
int daraja(int a)
{
cout << a << " sonining 4 darajasi: " << pow(a, 4) << endl;
}
int main()
{
int a, b, c, d;
cout << "a = ";
cin >> a;
cout << "b = ";
cin >> b;
cout << "c = ";
cin >> c;
cout << "d = ";
cin >> d;
daraja(a);
daraja(b);
daraja(c);
daraja(d);
}
Do'stlaringiz bilan baham: |