Check Out These Related Examples:: Scanf ("%d",&broj) Fwaof Fwoajfčasfž Afsklaćfasuifa

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

scanf("%d",&broj);fwaof

fwoajfčasfž

afsklaćfasuifa

1. fajkfčlafsćč#include <stdio.h>
2. int main()
3. {
4. int t1 = 0, t2 = 1, nextTerm = 0, n;
5.
6. printf("Enter a positive number: ");
7. scanf("%d", &n);
8.
9. // displays the first two terms which is always 0 and 1
10. printf("Fibonacci Series: %d, %d, ", t1, t2);
11.
12. nextTerm = t1 + t2;
13.
14. while(nextTerm <= n)
15. {
16. printf("%d, ",nextTerm);
17. t1 = t2;
18. t2 = nextTerm;
19. nextTerm = t1 + t2;
20. }
21.
22. return 0;
23. }
Output
Enter a positive integer: 100
Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,

Check out these related examples:


 Check Whether a Number is Positive or Negative
 Display Factors of a Number
 Check Whether a Number is Prime or Not
 Calculate the Power of a Number
 Count Number of Digits in an Integer
 Display Armstrong Number Between Two Intervals
 Check Whether a Number is Even or Odd
 Find the Largest Number Among Three Numbers

You might also like