next up previous
Next: About this document Up: Približek Previous: Ali?

Celoten program

#include<stdio.h>
#include<conio.h>
/*--------------------------------------------------------------*/
#include<stdio.h>
#include<math.h>
#include<conio.h>
#define sqr(x) ((x)*(x))

float Pribl_dva_pi() {
  int n;         /* n-kotnik */
  float Sn;      /* obseg le-tega */

  n= 2;          /* zacetni priblizek je 2-kotnik */
  Sn= 4;
  do {
    s= sqrt (2 - sqrt ( 4 - sqr (s/n) ) );
    n= 2*n ;
    Sn= n*S_n;
    printf("n=%d, Sn=%f \n", n, Sn);
  } while(getch()==`d`);
  return Sn;
} /* Pribl_dva_pi */

/*------------------------------------------------------------*/
void main() {
   float s;
   clrscr();

   s = Pribl_dva_pi();
   printf("Priblizek je %f \n",s);
} /* main */



Andrej Brodnik (Andy)
Fri Jan 9 14:21:53 MET 1998