ABDURAIMOV YORQINJON SWD025_3
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI
UNIVERSITETI
SWD015_3 -guruh talabasi
ABDURAIMOV YORQINJONning
“MA’LUMOTLAR TUZILMASI VA
ALGORITMLAR”
fanidan tayyorlagan
3-AMALIY ISHI
O’QITUVCHI: AXMADJONOV I
Toshkent – 2022
ABDURAIMOV YORQINJON SWD025_3
2-VARIANT
#include
using namespace std;
int findMaximum(int arr[], int low, int high)
{
int max = arr[low];
int i;
for (i = low + 1; i <= high; i++)
{
if (arr[i] > max)
max = arr[i];
else
break;
}
return max;
}
int main()
{
int arr[] = {1, 30, 40, 50, 60, 70, 23, 20};
int n = sizeof(arr)/sizeof(arr[0]);
cout << "MAKSIMAL ELEMENT : " <<
findMaximum(arr, 0, n-1) << endl ;
cout << "1 30 40 50 60 23 20" << endl ;
return 0;
}
ABDURAIMOV YORQINJON SWD025_3
Do'stlaringiz bilan baham: |