include stdio include stdlib define define PN printf int main void int

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <stdlib.h>
#define A 5
#define PN printf("\n")
int main(void)
{ int mass[A],i,max=0,otr=0,tmp;
//input
printf("Input mass\n");
for(i=0;i<A;i++)
scanf("%d", mass+i);
PN;
//jb
for(i=0;i<A;i++)
{ if(max<mass[i])
max=mass[i];
if(mass[i]<0 && otr>mass[i])
otr=mass[i];
}
tmp=mass[max];
mass[max]=mass[otr];
mass[otr]=tmp;
//out
printf("OUT\n\n");
for(i=0;i<A;i++)
printf("%d ",mass[i]);
PN;
system("PAUSE");
return 0;
}