# Algoritmlarni loyihalashtirish fanidan

 Sana 13.10.2020 Hajmi 38.25 Kb.

Algoritmlarni loyihalashtirish fanidan
 Laboratoriya ishi №3.

Topshiq javobi .

Massivni e’lon qilish.

#include

using namespace std;

int main(){

long a[100], double b[100];

return 0;

}

Massiv o'lchovini kiritish

#include

using namespace std;

int main(){

long n;

cin >> n;

long a[n], double b[n];

return 0;

}

Massiv elementlariga qiymat berish.

#include

using namespace std;

int main(){

long n, i;

cin >> n;

long a[n];

for (i = 1; i <= n; i++)

cin >> a[i]

return 0;

}

Massiv elementlarini chop etish.

#include

using namespace std;

int main(){

long n, i;

cin >> n;

long a[n];

for (i = 1; i <= n; i++)

cin >> a[i];

for (i = 1; i <= n; i++)

cout << a[i] << " ";

return 0;

}

Massiv elementlarini  saralash.

#include

using namespace std;

int main(){

long n, i, j;

cin >> n;

long a[n];

for (i = 1; i <= n; i++)

cin >> a[i];

for (i = 1; i < n; i++)

for (j = i + 1; j <= n; j++)

{

if (a[i] < a[j])

{

a[0] = a[i];

a[i] = a[j];

a[j] = a[0];

}

}

for (i = 1; i <= n; i++)

cout << a[i] << " ";

return 0;

}