include stdafx include stdlib include math int main int argc char argv

 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
#include "stdafx.h"
#include <stdlib.h>
#include <math.h>
int main(int argc, char *argv[])
{
int b=5;
double y, max, min, A, step, i;
A=0;
step=0;
min=0;
max=0;
while (A==0)
{
printf("A=");
scanf_s("%lf",&A);
}
while (step<=0)
{
printf("step=");
scanf_s("%lf",&step);
}
max=min=A*A+5;
if (A>0)
for (i=-A;i<=A;i+=step)
{ y=i*i+b;
if (max<y) max=y;
if (min>y) min=y;
}
if (A<0)
for (i=-A;i>=A;i-=step)
{ y=i*i+b;
if (max<y) max=y;
if (min>y) min=y;
}
printf ("%lf < F(x) < %lf\n",min,max);
system ("PAUSE");
return 0;
}