Guruh talabasi Rajabov Islombek
Download 468.46 Kb.
|
1 2
Bog'liq5-Tajriba ishi topshiriqlari
914_19-guruh talabasiRajabov IslombekTopshiriqPufaksimon saralash usulidan foydalanib, saralashni amalga oshirish dasturini ishlab chiqish (variantga mos ravishda): A massivning eng katta (eng kichik) elementini ekranga chiqarish dasturini tuzing. #include using namespace std; int main(){ int n;
cout<<"n = "; cin>>n;
int a[100]; for(int i = 1; i <= n; i++){ cin >> a[i]; } int min = a[1]; for (int i = 2; i <= n; i++) { if (a[i] < min) min = a[i]; } int max= a[1]; for (int i = 2; i <= n; i++) { if (a[i] > max) max = a[i]; }
using namespace std; void saralash (int a[], int n){
int i,j;
if(a[i]>a[j]) swap(a[i],a[j]);
}
} int i,n;
cout<<"N : "; cin>>n; int a[n]; cout< for(i=0; i cout<<" Kamayish tartibida saralangan massiv.\n";
saralash(a,n); for(i=0; i system("pause"); Download 468.46 Kb. Do'stlaringiz bilan baham: |
1 2
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling