Zbekiston respublikasi raqamli texnologiyar vazirligi muhammad al-xorazmiy nomidagi


Download 22.1 Kb.
Sana02.12.2023
Hajmi22.1 Kb.
#1779835
Bog'liq
OtabekDasturlash


O’ZBEKISTON RESPUBLIKASI RAQAMLI TEXNOLOGIYAR
VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI


Informatika asoslari kafedrasi
Dasturlash I bo’yicha

Amaliy ish




Bajardi : Olimjonov Otabek

Toshkent-2023


28 – variant

1 – masala





#include
#include

using namespace std;


void SortDec3(double &a, double &b, double &c) {


if (a < b) swap(a, b);
if (a < c) swap(a, c);
if (b < c) swap(b, c);
}

int main() {


double a1 = 5.6, b1 = 2.3, c1 = 8.1;
double a2 = 10.5, b2 = 7.2, c2 = 3.8;

SortDec3(a1, b1, c1);


SortDec3(a2, b2, c2);


cout << "Tartiblangan ketma-ketlik 1: " << a1 << ", " << b1 << ", " << c1 << endl;


cout << "Tartiblangan ketma-ketlik 2: " << a2 << ", " << b2 << ", " << c2 << endl;

return 0;


}


2 - masala



#include

using namespace std;

int main() {
double Y[] = {-5.1, 18, 75, 0.1, -17, 2.5, 6.35, 17.8};

double product = 1.0;

for (double element : Y) {
if (element < 0) {
product *= element;
}
}

cout << "Negativ elementlar ko'patymasi: " << product << endl;

return 0;
}

3 - masala



#include
#include
#include

using namespace std;

int main() {
vector> C = {
{1, 2, 3},
{4, 2, 1},
{3, 4, 5}
};

unordered_set distinctCounts;

for (const auto& row : C) {
for (int element : row) {
distinctCounts.insert(element);
}
}

cout << "Alohida hisoblar soni: " << distinctCounts.size() << endl;



return 0;
}

Download 22.1 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling