Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Homework number 4 - fibonacci sussquences.

Name: Anonymous 2010-01-19 4:00

Consider the generalized fibonacci sequences:
4, 1, 5, 6, 11, 17, 28, ...
3, 2, 5, 7, 12, 19, 31, ...
Write a program that takes two numbers as input and prints as many Sussmans as the tenth number in the resulting fibonacci sequence.
USE RECURSION.

Name: Anonymous 2010-01-19 21:18

>>17,20

So 309 is the correct answer?

#include <stdio.h>

int main (void)
{
    int a, b, x;
    scanf("%d", &a), scanf("%d", &b);
   
    if (b > a)
        x = b, b = a, a = x;
   
    for (x = 2; x < 10; x++)
        a += b, b = a - b;
   
    for (x = 1; x <= a; x++)
        printf("SUSSMAN NO. %d\n", x);
   
    return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List