#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define OR |
// I like booleans. Screw you.
//This program will calculate fibonacci numbers from a given seed and output the results to a text file, named fibonacci.txt
int main(void)
{
int counter = 0;
char i[256]; //number of iterations as a string, will be converted to an integer
signed int iterint; //converted
unsigned int x; //working variable sort of
signed int z; //see above
int iterlength;
double a1 = 1;
double a2 = 0;
double a3 = 1;
Menu:
printf("This program will calculate fibonacci numbers from a given seed\nup to a certain point and output them to a text file, ''fibonacci.txt''");
printf("\n\nInput number of iterations (max 10000):");
gets(i);
iterlength = strlen(i);
iterint = atoi(i);
x = -1;
TEST1:
if ((x < iterlength))
{
z = i[x];
x = x + 1;
goto TEST2;
}
else while (counter != iterint)
{
FILE *fp = fopen("c:\\fibonacci.txt", "a+");
fprintf(fp,"%f\n",a1);
a1 = a2 + a3;
a3 = a2;
a2 = a1;
counter = counter + 1;
}
if (counter = iterint)
{
return 0;
}
TEST2:
if ((z < 1) OR (z > 9))
{
printf("\n\nYOU DUN GOOFED. DON'T TYPE IN STUPID SHIT.\n\n");
goto Menu;
}
else
{
goto TEST1;
}
}