Write a program to print the Fibonacci sequence up to a given term using function

#include<stdio.h> int fibonacci(int); int main() { int i,n; printf("Enter tearm: \n"); scanf("%d",&n); for(i=1;i<=n;i++) printf("%d\t",fibonacci(i)); return 0; } int fibonacci(int n) { int i,a=0,b=1,next; for(i=1;i<n;i++) { next=a+b; a=b; b=next; } return a; }

**Output**

Enter term:

4

0 1 1 2