0% found this document useful (0 votes)
5 views3 pages

Assingment 16

The document outlines an assignment to write a program that prints the Fibonacci series. It includes an algorithm, flowchart, and a sample C program to implement the Fibonacci series calculation. The program prompts the user for the number of terms and displays the series accordingly.

Uploaded by

anknownff7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Assingment 16

The document outlines an assignment to write a program that prints the Fibonacci series. It includes an algorithm, flowchart, and a sample C program to implement the Fibonacci series calculation. The program prompts the user for the number of terms and displays the series accordingly.

Uploaded by

anknownff7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ASSIGMENT:16

QUESTION:
WAP to print the Fibonacci series.

ALGORITHM:
STEP 1: Start
STEP 2: Declare variable:a,b,c,i,n
STEP 3: Print “Enter value of n:”
STEP 4: Input Value: n
STEP 5: Calculate and Initialize.
a=0;
b=1;
c=0;
STEP 6: for(i=1;i<=n;i++)
STEP 7: Print “%d”,c
STEP 8: Calculate & Initialize
a=b;
b=c;
c=a+b;
STEP 9: stop

CREATED BY :PALAK DAKSH


FLOWCHART:
Start

Declare variable:a,b,c,i,n

Print: “Enter value of n:”

Input: n

Calculate and
Initialize
a=0;
b=1;
c=0;

for(i=1;i<=n;i++)

Calculate & Initialize


a=b;
b=c;
c=a+b;

Print:“%d”,c

Stop

CREATED BY :PALAK DAKSH


PROGRAM:
#include <stdio.h>
int main()
{
int i, n;
int a = 0, b = 1;
int nextTerm = a+b;
printf("Enter the number of terms: ");
scanf("%d", &n);
printf("Fibonacci Series: %d, %d, ", t1, t2);
for (i = 3; i <= n; ++i)
{
printf("%d, ", nextTerm);
a=b;
b = nextTerm;
nextTerm = a+b;
}
return 0;
}

INPUT/OUTPUT:

CREATED BY :PALAK DAKSH

You might also like