160 |
kaklik |
1 |
#include <math.h>
|
|
|
2 |
#include <stdio.h>
|
|
|
3 |
#include "./vypocty.h"
|
|
|
4 |
|
|
|
5 |
float obvod_ctverce(float strana); //vypocita obvod ctverce o strane a
|
|
|
6 |
float obsah_ctverce(float strana); // vypocita obsah crverce o strane a
|
|
|
7 |
float obvod_kruznice(float polomer); // spocita obvod kruznice z polomeru
|
|
|
8 |
float obsah_kruznice(float polomer); // spocit obsah kruznice z polomeru
|
|
|
9 |
|
|
|
10 |
int main( void )
|
|
|
11 |
{
|
|
|
12 |
float r;
|
|
|
13 |
float r2;
|
|
|
14 |
float a;
|
|
|
15 |
float a2;
|
|
|
16 |
|
|
|
17 |
printf("Zadejte polomer r=");
|
|
|
18 |
scanf("%f",&r);
|
|
|
19 |
|
|
|
20 |
printf("obvod male kruznice Omk=%25.2f \n",obvod_kruznice(r));
|
|
|
21 |
printf("obsah male kruznice Smk=%25.2f \n",obsah_kruznice(r));
|
|
|
22 |
|
|
|
23 |
a=2*r; // a je strana vnitrniho ctverce
|
|
|
24 |
printf("obvod vnitrniho ctverce Oc=%25.2f \n",obvod_ctverce(a));
|
|
|
25 |
printf("obsah vnitrniho ctverce Sc=%25.2f \n",obsah_ctverce(a));
|
|
|
26 |
|
|
|
27 |
r2=M_SQRT2*r; // polomer kruznice
|
|
|
28 |
printf("obvod kruznice Ok=%25.2f \n",obvod_kruznice(r2));
|
|
|
29 |
printf("obsah kruznice Sk=%25.2f \n",obsah_kruznice(r2));
|
|
|
30 |
|
|
|
31 |
a2=2*r2; // strana vetsiho ctverce
|
|
|
32 |
printf("obvod velkeho ctverce Ovc=%25.2f \n",obvod_ctverce(a2));
|
|
|
33 |
printf("obsah velkeho ctverce Svc=%25.2f \n",obsah_ctverce(a2));
|
|
|
34 |
|
|
|
35 |
}
|
|
|
36 |
|