|
Amaliy topshiriq Bajardi: Zoirov Bahodir
|
Sana | 20.05.2024 | Hajmi | 82,04 Kb. | | #246504 |
Bog'liq Amaliy
O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARNI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD Al- XORAZMIIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
Mobil ilovalarni ishlab chiqish (DI) fanidan bajargan ishi
Amaliy topshiriq
Bajardi:Zoirov Bahodir
Tekshirdi: Achilov Baxodir
Toshkent-2024
18-variant
1-misol
Dastur sharti:
Dastur kodi:
import 'dart:math';
const double pi = 3.1415;
double calculateCircleArea(double radius) {
return pi * radius * radius;
}
void main() {
double radius1 = 3.0;
double radius2 = 4.5;
double radius3 = 7.2;
double area1 = calculateCircleArea(radius1);
double area2 = calculateCircleArea(radius2);
double area3 = calculateCircleArea(radius3);
print("Radius $radius1 uchun doiraning yuzi: $area1");
print("Radius $radius2 uchun doiraning yuzi: $area2");
print("Radius $radius3 uchun doiraning yuzi: $area3");
}
Dastur natijasi:
2-misol
Dastur sharti:
Dastur kodi:
import 'dart:io';
void main() {
print('N sonini kiriting:');
int n = int.parse(stdin.readLineSync()!);
print('To\'plam elementlarini kiriting:');
List elements = [];
for (int i = 0; i < n; i++) {
elements.add(int.parse(stdin.readLineSync()!));
}
int maxElement = elements[0];
for (int i = 1; i < n; i++) {
if (elements[i] > maxElement) {
maxElement = elements[i];
}
}
int firstIndex = elements.indexOf(maxElement);
int lastIndex = elements.lastIndexOf(maxElement);
if (firstIndex == lastIndex) {
print(0);
} else {
int countBetween = lastIndex - firstIndex - 1;
print(countBetween);
}
}
Dastur natijasi:
3-misol
Dastur sharti:
Dastur kodi:
import 'dart:io';
class Laptops {
List elements;
Laptops(this.elements);
int findMaxElement() {
int maxElement = elements[0];
for (int i = 1; i < elements.length; i++) {
if (elements[i] > maxElement) {
maxElement = elements[i];
}
}
return maxElement;
}
int countElementsBetweenFirstAndLastMax() {
int maxElement = findMaxElement();
int firstIndex = elements.indexOf(maxElement);
int lastIndex = elements.lastIndexOf(maxElement);
if (firstIndex == lastIndex) {
return 0;
} else {
return lastIndex - firstIndex - 1;
}
}
}
void main() {
print('N sonini kiriting:');
int n = int.parse(stdin.readLineSync()!);
print('To\'plam elementlarini kiriting:');
List elements = [];
for (int i = 0; i < n; i++) {
elements.add(int.parse(stdin.readLineSync()!));
}
Laptops laptops = Laptops(elements);
int result = laptops.countElementsBetweenFirstAndLastMax();
print('Birinchi va oxirgi uchragan eng katta element orasidagi elementlar soni: $result');
}
Dastur natijasi:
|
| |