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