Bajardi: Bekpo’latov Ahrorbek
Download 154.2 Kb.
|
variant 6
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI Amaliy ish Bajardi: Bekpo’latov Ahrorbek TOSHKENT 2023
#include using namespace std; int main() { int n, m; cout << "Matrisa o'lchami: \n"; cout << "n = "; cin >> n; cout << "m = "; cin >> m; int matrix[n][m]; int max_val = INT_MIN; int max_col; cout << "Matrisa elementlarini kiriting:" << endl; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { matrix[i][j] = rand() % 100 + 1; if (matrix[i][j] > max_val) { max_val = matrix[i][j]; max_col = j; } } } cout << "Matrisa:" << endl; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cout << matrix[i][j] << " "; } cout << endl; } cout << endl; for (int i = 0; i < n; i++) { for (int j = max_col; j < m - 1; j++) { matrix[i][j] = matrix[i][j + 1]; } } m--;
cout << "\nYangi matrisa:" << endl;
#include using namespace std; int main() { int a; cout << "O'nlik sanoq sistemasidagi sonni kiriting: "; cin >> a; int b[32]; int i = 0; while (a > 0) { b[i] = a % 2; a /= 2; i++; } cout << "Ikkilik sanoq sistemasidagi qiymat: "; for (int j = i - 1; j >= 0; j--) { cout << b[j]; } cout << endl; return 0; } 3 –topshiriq.
#include using namespace std; int SumRange(int A, int B) { if (A > B) { return 0; } int sum = 0; for (int i = A; i <= B; i++) { sum += i; } return sum; } int main() { int A, B, C; cout << "A ni kiriting: "; cin >> A; cout << "B ni kiriting: "; cin >> B; cout << "C ni kiriting: "; cin >> C; int sum = SumRange(A, B) + SumRange(B, C); cout << A << " dan " << B << " gacha va " << B << " dan " << C << " gacha sonlar yig'indisi: " << sum << endl; return 0; } Download 154.2 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling