1-topshiriq
Dastur kodi:
#include
#include
using namespace std;
int main() {
double W = 0.0;
for (int i = 1; i <= 4; i++) {
double term = pow(-1, i) * pow(i - 3, 2) / tgamma(i + 1);
W += term;
}
cout << "W = " << W << endl;
return 0;
}
Dastur natijasi:
2-topshiriq
Dastur kodi:
#include
#include
using namespace std;
int main() {
double x;
cout << "x ni kiriting: ";
cin >> x;
double result = x;
double term = x;
int factorial = 1;
for (int i = 1; i <= 3; i++) {
term *= (x * x);
factorial *= (2 * i * (2 * i + 1));
result += term / factorial;
}
cout << "Natija: " << result << endl;
return 0;
}
Dastur natijasi:
3-topshiriq
Dastur kodi:
#include
using namespace std;
int main() {
int matrix[4][4] = {
{0, 2, 3, 4},
{5, 0, 7, 8},
{9, 10, 0, 12},
{13, 14, 15, 0}
};
cout << "Chop etilgan matritsa:" << endl;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) {
cout << "0 ";
} else {
cout << matrix[i][j] << " ";
}
}
cout << endl;
}
return 0;
}
Dastur natijasi:
Do'stlaringiz bilan baham: |