// iceb00 Details
// C template by Bernice
// pass comments frequently
// This is an ongoing project and will be revised as soon as time permits.
// Creation Date: 26-Oct-2007
// Revision Date: 13-dec-2007
#include
// Declare global here
/* Thought I would write my self summary for OK Cupid in my favourite language C (proper command line none of the ++ stuff). If you don't get as far as compiling and running this program don't worry when revised to a workable form an executable download will be made available. :)
Windows Executable Download is at
ftp://roust.gotdns.com/winbin/selfsummary.exe */
int main()
{
// declare variables here
int b, yearss=8, dayss, subject, flag = 1, count = 0, i, n = 0, m = 1, l = 1;
// declare function prototypes here
void test(int);
int isprime(int);
int isfib(int);
int gcd(int, int);
void intro(int);
// put design code here
printf("please enter a positive integer ? ");
scanf("%d", &subject);
test(subject);
intro(yearss);
flag = isprime(subject);
// Test if Fibonacci and set flag for(i = 1; i <= subject; i = i + n) { ++count; if(count % 2 == 0) n = l, m = i; else n = m, l = i;
if(i == subject) flag = flag -2;
// printf("i = %d\tn = %d\tm = %d\n", i, n, m ); // debug }
// display result // printf("flag = %d\n", flag); // debug
if(flag < 0) { printf("\n%d is the %dth number in the fibonacci sequence", subject, count); flag = flag +2; }
if(flag > 0) printf("\n%d is a prime number\n", subject); else printf("\n%d is not a prime number and therfor very boring\n", subject);
printf("How about another positive integer please ? ");
scanf("%d", &b);
printf("The Greatest common divisor of %d and %d is %d", subject, b, gcd(subject,b));
printf("\n\n\tDONE\n\n"); // shows finished
return(0);
}
//find greatest common denomonator int gcd(int x, int y) { y = y % x;
if(y != 0)
x = gcd(y,x);
return(x); }
// test input is positive integer within range void test(int x) { if(x > 2100000000 ) { printf("\nNumber is outside range maximum of 2,100,000,000\n\n"); exit(0); }
// display error and exit if not positive integer if(x < 0) { printf("\nNumber must be positive\n\n"); exit(0); } return; }
// Test if prime and set flag int isprime(int x) { int flag, i;
for(i = 2; i < x; i++) { if(x%i == 0) { flag = flag -1; break; } } return(flag); }
// Intoduction message void intro(int a) { printf("Hi\, I'm Bernice\,\nI am transgernderd male to female and live in West London.\n");
printf("I had my operation %d Years\, ago and am very much all woman now.\n", a);
printf("and I just love it :)\nI am wnat I like to call 5' 14\" tall known to enjoy the occational drink\, a keen archer I shoot both Compund Bow and English Longbow.");
return; }
I am big, clumsy, and beutiful