TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: All
from: Paul Edwards
date: 1996-09-03 01:03:12
subject: lmath.c

/* Written by Roy McNeill */
/* Released to the public domain */
/* Modified by Paul Edwards */
/* Set i to the number you want the reciprocal of */

#define PLACES 501

#include 
#include 
#include 

int main(void)
{
    long i, j, top;
    int place;
    char ans[PLACES + 1], buf[40];

    i = 300;
    top = 1;
    for (place = 0; place < PLACES; place++)
    {
        j = top / i;            /* divide */
        sprintf(buf, "%d", j);  /* convert to string. Answer should be 1
                                   digit. */
        ans[place] = *buf;      /* add digit to big answer */
        top = top - j * i;      /* get remainder */
        top *= 10;              /* shift one decimal place */
    }
    ans[PLACES] = '\0';
    printf("ans is %s\n", ans);
    return 0;
}
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.