0% found this document useful (0 votes)
70 views1 page

#Include

This C program defines a structure with two integer fields, takes user input for a number, and uses that number in a for loop to calculate Fibonacci numbers by adding the previous two values and updating those values each iteration, printing the current Fibonacci number. It initializes three integers for the first two Fibonacci values and a counter, takes input, loops to calculate via the structure fields and print the Fibonacci numbers up to the input number.

Uploaded by

Kumari Mugilan
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)
70 views1 page

#Include

This C program defines a structure with two integer fields, takes user input for a number, and uses that number in a for loop to calculate Fibonacci numbers by adding the previous two values and updating those values each iteration, printing the current Fibonacci number. It initializes three integers for the first two Fibonacci values and a counter, takes input, loops to calculate via the structure fields and print the Fibonacci numbers up to the input number.

Uploaded by

Kumari Mugilan
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/ 1

#include<stdio.

h>

main()

struct Mystruct

int a;

struct Mystruct *b;

};

int a=0,b=1,fib=0,i,n;

scanf("%d",&n);

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

fib=fib+a;

a=b;

b=fib;

printf("\n %d",fib);

You might also like