Talabasi : Choriyev Hamidullo; Tekshirdi : Fayzullaeva Zarnigor; Variant №7


Download 29.46 Kb.
Sana18.11.2023
Hajmi29.46 Kb.
#1784415
Bog'liq
HCH

241-23 talabasi : Choriyev Hamidullo ; Tekshirdi : Fayzullaeva Zarnigor;

Variant №7

Laboratoriya ishi №2




1)



#include


using namespace std;
int main() {
int n, m, s=0;
cout << "n = "; cin >> n;
cout << "m = "; cin >> m;
for(int i=3; i<=n; i++) {
for(int j=2; j<=m; j++) {
s += 2*i + j*j;
cout << "i=" << i << ", j=" << j << ", s=" << s << endl;
}
}
cout << s;

}

2)



#include
using namespace std;
int main() {
int n;
cout << "Nechta fibonachi sonlarini chiqarmoqchisiz: ";
cin >> n;
int a = 0, b = 1, son;
cout << "Fibonachi sonlari: ";
while (n > 0) {
cout << a << ", ";
son = a + b;
a = b;
b = son;
n--;
}
return 0;
}


#include


using namespace std;
int main()
{
float n, x, min = 1000;
bool exist = false;
cout << "n = "; cin >> n;
for (int i = 0; i < n; i++)
{
cout << (i + 1) << "-son: "; cin >> x;
if (x > 20)
{
exist = true;
if (x < min)
min = x;
}
}
cout << endl;
if (exist)
cout << "20 dan kattalar orasida eng kichigi: " << min;
else
cout << "20 dan katta son yo`q";
return 0;
}








#include


using namespace std;
double kvadratYuzi(double a) {
return a * a;
}
double kvadratPerimetri(double a) {
return 4 * a;
}
int main() {
double a;
cout << "a: ";
cin >> a;
cout << "Kvadratning yuzi: " << kvadratYuzi(a) << endl;
cout << "Kvadratning perimetri: " << kvadratPerimetri(a) << endl;
return 0;
}



#include
#include
using namespace std;
void kvadrat_tenglama_ildizlar_soni(double a, double b, double c) {
double D = b*b - 4*a*c;
if(sqrt(D) > 0){
cout << "Kvadrat tenglamani 2ta ildizi bor\n";
}
else if(sqrt(D)==0){
cout << "Kvadrat tenglamani 1ta ildizi bor\n";
}
else{
cout << "Kvadrat tenglamani ildizi mavjud emas\n";
}
}
void kvadrat_tenglama_ildizlari(double a, double b, double c) {
double D = b*b - 4*a*c, x1, x2;
x1 = (-b + sqrt(D))/(2*a);
x2 = (-b - sqrt(D))/(2*a);
if(x1=x2) {
cout << "x1 = " << x1 << endl; }
else {
cout << "x1 = " << x1 << endl;
cout << "x2 = " << x2 << endl; }
}
int main() {
double a, b, c;
cout << "a: "; cin >> a;
cout << "b: "; cin >> b;
cout << "c: "; cin >> c;
kvadrat_tenglama_ildizlar_soni(a, b, c);
kvadrat_tenglama_ildizlari(a, b, c);
return 0;
}

Download 29.46 Kb.

Do'stlaringiz bilan baham:




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