include stdio include stdlib define define PN printf include locale in

 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
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include <stdlib.h>
#define A 5
#define PN printf("\n")
#include <locale.h>
int main(void)
{ int mass[A],i,max=0,otr=0,tmp;
setlocale(LC_ALL, "Russian");
//ââîä
printf("ââåäèòå ìàññèâ\n");
for(i=0;i<A;i++)
scanf("%d", mass+i);
PN;
//ïðîâåðêà
for(otr=0;otr<=A && mass[otr]>=0;otr++)
if(otr==A)
{
printf("Îòðèöàòåëüíûõ íåò!\n");
system("PAUSE");
return 0;
}
//çàäà÷à
for(i=0;i<A;i++)
{ if(mass[i]<0)
otr=i;
if(mass[i]>mass[max])
max=i;
}
tmp=mass[otr];
mass[otr]=mass[max];
mass[max]=tmp;
//âûâîä
printf("âûõëîï\n\n");
for(i=0;i<A;i++)
printf("%d ",mass[i]);
PN;
system("PAUSE");
return 0;
}