View Code of Problem 23

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
	unsigned int m;
	unsigned long long little=0,big=1;
	unsigned  long long rabbits[91]={0};
	rabbits[1] = 1;
	scanf("%d",&m);
	while(m!=0){
				
			little=0,big=1;
			for(int i=2; i<=m; i++){
				unsigned long long temp = big;
				big = big + little;
				little = temp;
			}
			rabbits[m] = little + big;
		
		printf("%lld\n",rabbits[m]);
		scanf("%d",&m);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 23