#include<stdio.h> void fibonacci(int *r) { int a = 0, b = 1, display = 0; printf("fibonacci series: %d %d ", a, b); display = a + b; while (display < *r) { printf("%d ",display); a = b; b = display; display = a + b; } printf("\n"); } int main() { int m; printf("Enter number for fibonacci: "); scanf_s("%d", &m); fibonacci(&m); return 0; }
Thursday, 26 March 2015
Fibonacci series using Function & Pointer in C
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment