include stdio include stdlib int main int argc char argv int step max

 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int b=5, i, t, A, step, max, min, y;
t=0;
A=0;
step=0;
min=0;
max=0;
while (A==0)
{printf(" A = ");
scanf("%d",&A);}
while (step<=0)
{printf("step>0 step=");
scanf("%d",&step);}
if (A>0)
{for(i=-A;i<=A;i+=step)
{
y=i*i+b;
if (t==0)
{min=y;
max=y;
t=1;}
else {if (y<min) min=y;
if (y>max) max=y;}
}
}
if (A<0)
{for(i=-A;i>=A;i-=step)
{
y=i*i+b;
if (t==0)
{min=y;
max=y;
t=1;}
else {if (y<min) min=y;
if (y>max) max=y;}
}
}
if (min==max) printf("funkciy imeet tiolko odno znachenye: %d\n", y);
else {printf("minimalnoe znachenye: %d\n", min);
printf("maximalnoe znachenye: %d\n", max);}
system("PAUSE");
return 0;
}