1-misol. (2-topshiriq)
Download 15.33 Kb.
|
3-topshiriq. Amatova Oygul
Toshkent axborot texnalogiyalari Universiteti TTF yo’nalishi 510-23-guruh dasturlash1-b-PRG 009-2 guruhi talabasi Amatova Oygulning 3-topshirig’i 1-misol. (2-topshiriq). #include using namespace std; int main() { int n[10]={1,2,8,-1,-3,-5,3,5,8,-9}; int c=1; if(n[0]<=0) { cout<<"natija=0"; return 0; } for(int i=0;i<10;i++) { if(n[i]<0) { cout<<"natija="< }else { c*=n[i]; } } cout<<"Natija="< } 2-misol.(2-topshiriq). #include using namespace std; int main() { int n[10]={1,2,8,-1,-3,-5,3,5,8,-9}; int min=n[0]; int max=n[0]; for(int i=0;i<10;i++) { if(n[i]>max) { max=n[i]; } if(n[i] min=n[i]; } } cout<<"minimumi="< } 3-misol.(2-topshiriq). #include #include using namespace std; double calculateTriangleArea(double a, double b, double c) { double s = (a + b + c) / 2.0; double area = sqrt(s * (s - a) * (s - b) * (s - c)); return area;
int main() { double a, b, c; cout << "Uchburchak tomonlarini kiriting:\n"; cout << "a = "; cin >> a; cout << "b = "; cin >> b; cout << "c = "; cin >> c; double area = calculateTriangleArea(a, b, c); cout << "Uchburchak yuzasi: " << area < return 0; Download 15.33 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling