Code:
#include <stdio.h>
#include <conio.h>
#include <limits.h>
int main()
{
int start, ende;
printf("\n\tfibonacci-reihe\n\n\tstart:\t");
scanf("%i", &start);
printf("\tende:\t");
scanf("%i", &ende);
if(start < 0) start *= -1;
if(ende < 0) ende *= -1;
if(start > ende)
{
start ^= ende;
ende ^= start;
start ^= ende;
}
int a, b, c;
a = start;
b = 2 * a - 1;
c = 0;
printf("\n\t%i %i", a, b);
while(c < ende && c < INT_MAX)
{
if((c = a + b) > ende) break;
printf(" %i", c);
a = b;
b = c;
}
getch();
return 0;
}
Added after 56 seconds:
Hm, zu langsam und buggy. Verdammt.