102- guruh talabasi Samadov Abdulla 2-hafta uchun topshiriq javobi 14-nomer
Download 214.58 Kb. Pdf ko'rish
|
2-hafta topshiriq javobi
102- guruh talabasi Samadov Abdulla 2-hafta uchun topshiriq javobi 14-nomer Boshlash Int Masssiv[n] temp
massiv
[ j ];
massiv [ j ]
= massiv
[ 0 ];
massiv [ 0 ]
= temp
;
Natija Tugash
#include
using
namespace
std
;
int main
()
{
int
n ;
cout
<< "
massiv
elemantini ulchamini
=
" <<
endl ;
cin
>> n ;
int
massiv [ n ];
for
( int
i = 0 ; i
n ;
++){
cout << i + 1 << "
-
elemant =
" ;
cin
>> massiv
[ i ];
}
int
temp ;
int
key
= 0 ;
for ( int j = 0 ; j < n ; j ++){
if (( massiv [ j ]- massiv [ j + 1 ])% 2 == key ){
temp
=
massiv [ j ];
massiv [ j ]
= massiv
[ 0 ];
massiv [ 0 ]
= temp
;
cout <<
"ayirmasi juft
bolgan
massiv
indexsi
=
" << j + 1 << endl
;
}
}
cout
"
juft
elemant
1-
elemantga
kuchirildi \n"
;
for ( int i = 0 ; i < n ; i ++){
cout << i + 1 << "
-
element =
" << massiv
[ i ]<< endl ;
}
return
0
Download 214.58 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling