 1 - 4 of 4 Posts

#### dangerousHobo

·
Joined
·
3,590 Posts
If you have any challenges then you can send them to myself or BFRD and we'll add them to the sticky challenges. The reason that was has been dead is because I didn't have any more fun ideas to go off of!

#### dangerousHobo

·
Joined
·
3,590 Posts
Fibonacci sums

Code:
Code:
``````/*
Fibonacci sums
dangeroushobo - Overclock.net
*/
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[]) {
int p1 = 1;
int p2 = 2;
int p;

printf("%d, %d, ", p1, p2);
while ( (p = p1 + p2) < 4000000 ) {
printf("%d, ", p);
p1 = p2;
p2 = p;
}
return 0;
}``````

#### dangerousHobo

·
Joined
·
3,590 Posts
Factional sum

Code:
Code:
``````/* Factional sums
dangeroushobo - Overclock.net
*/
#include <stdio.h>
#include <stdlib.h>

int
factorial(int num) {
int i = num--;
while ( num > 0 ) {
i *= num--;
}
return i;
}

int
main(int argc, char *argv[]) {
int num = 0;
int qnt;
int sum;

while ( num < 4000000 ) {
qnt = num;
sum = 0;
while ( qnt > 0 ) {
sum += factorial(qnt % 10);
qnt = qnt / 10;
}

if (sum == num) {
printf("%d ", num);
}
num++;
}
printf("n");
return 0;
}``````

#### dangerousHobo

·
 Originally Posted by decompiled I was about to do the date calculation in PL/SQL but I forget that the UFC has a big event tonight =).