{"id":70674,"date":"2022-06-06T13:05:50","date_gmt":"2022-06-06T07:35:50","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/"},"modified":"2025-09-26T11:05:47","modified_gmt":"2025-09-26T05:35:47","slug":"fibonacci-series-in-c","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/","title":{"rendered":"C Program To Display Fibonacci Sequence"},"content":{"rendered":"\n<p>Fibonacci in C shows up in programming classes and job interviews. It's perfect for learning loops, recursion, and why some code runs fast while other code crawls.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.mygreatlearning.com\/blog\/c-tutorial\/\">C <\/a>makes the performance differences really obvious. Write it wrong and you'll wait forever for results. Write it right and it runs instantly. That's a valuable lesson.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"whats-the-fibonacci-sequence\">What's the Fibonacci Sequence?<\/h2>\n\n\n\n<p>It's just adding the previous two numbers:<\/p>\n\n\n\n<p>0, 1, 1, 2, 3, 5, 8, 13, 21, 34...<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-full zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-1756379835270.webp\"><img decoding=\"async\" width=\"800\" height=\"300\" src=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-1756379835270.webp\" alt=\"Fibonacci Sequence\" class=\"wp-image-111397\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-1756379835270.webp 800w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-1756379835270-300x113.webp 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-1756379835270-768x288.webp 768w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-1756379835270-150x56.webp 150w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Start with 0 and 1. Then:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0 + 1 = 1<\/li>\n\n\n\n<li>1 + 1 = 2<\/li>\n\n\n\n<li>1 + 2 = 3<\/li>\n\n\n\n<li>2 + 3 = 5<\/li>\n<\/ul>\n\n\n\n<p>Keep going. The math rule is F(n) = F(n-1) + F(n-2).<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy PRO<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/learn-c-programming-from-scratch\" class=\"courses-cta-title-link\">C Programming Course: Master C with Hands-on Projects<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Join our C Programming Course and learn C syntax, operators, expressions, control flow, functions, pointers, structures, file handling, memory management, and modular programming. Build real-world skills through practical projects!<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>2 Projects<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>10 Hrs<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/learn-c-programming-from-scratch\" class=\"courses-cta-button\">\n                C Programming Course with Certificate\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"method-1-simple-loop-best-choice\">Method 1: Simple Loop (Best Choice)<\/h2>\n\n\n\n<p>This is what you want 95% of the time. You initialize the first two numbers, then loop to calculate the rest.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n#include &amp;lt;stdio.h&gt;\n\nvoid printFibonacci(int n) {\n    long long first = 0, second = 1, next;\n    \n    if (n &gt;= 1) {\n        printf(&quot;Fibonacci Series: &quot;);\n        printf(&quot;%lld &quot;, first);\n    }\n    if (n &gt;= 2) {\n        printf(&quot;%lld &quot;, second);\n    }\n    \n    for (int i = 3; i &amp;lt;= n; i++) {\n        next = first + second;\n        printf(&quot;%lld &quot;, next);\n        first = second;\n        second = next;\n    }\n    printf(&quot;\\n&quot;);\n}\n\nint main() {\n    int terms;\n    printf(&quot;How many Fibonacci numbers? &quot;);\n    scanf(&quot;%d&quot;, &amp;amp;terms);\n    \n    if (terms &amp;lt;= 0) {\n        printf(&quot;Please enter a positive number.\\n&quot;);\n        return 1;\n    }\n    \n    printFibonacci(terms);\n    return 0;\n}\n\n<\/pre><\/div>\n\n\n<p>Why this works:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fast: calculates each number once<\/li>\n\n\n\n<li>Uses almost no memory<\/li>\n\n\n\n<li>Handles edge cases properly<\/li>\n\n\n\n<li>Works for numbers up to the 92nd Fibonacci number<\/li>\n<\/ul>\n\n\n\n<p><strong>Note:<\/strong> We use <code>long long<\/code> instead of <code>int<\/code> because Fibonacci numbers get huge fast. Regular <code>int<\/code> overflows around the 47th number.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"method-2-recursion-looks-nice-runs-terrible\">Method 2: Recursion (Looks Nice, Runs Terrible)<\/h2>\n\n\n\n<p>This matches the math formula but has a big problem:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n#include &amp;lt;stdio.h&gt;\n\nlong long fibonacci(int n) {\n    if (n &amp;lt;= 1) {\n        return n;\n    }\n    return fibonacci(n-1) + fibonacci(n-2);\n}\n\nint main() {\n    int terms;\n    printf(&quot;How many terms? &quot;);\n    scanf(&quot;%d&quot;, &amp;amp;terms);\n    \n    printf(&quot;Fibonacci Series: &quot;);\n    for (int i = 0; i &amp;lt; terms; i++) {\n        printf(&quot;%lld &quot;, fibonacci(i));\n    }\n    printf(&quot;\\n&quot;);\n    \n    return 0;\n}\n\n<\/pre><\/div>\n\n\n<p>The problem: Try <code>fibonacci(40)<\/code>. It'll take minutes because it recalculates everything repeatedly. <code>fibonacci(3)<\/code> gets calculated dozens of times just to find <code>fibonacci(10)<\/code>.<\/p>\n\n\n\n<p>This is O(2^n) time complexity - exponentially slow. Don't use this for anything real.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"method-3-smart-recursion-with-memory\">Method 3: Smart Recursion with Memory<\/h2>\n\n\n\n<p>If you want recursion that actually works, store your results:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n#include &amp;lt;stdio.h&gt;\n\nlong long memo&#x5B;100] = {0}; \/\/ Global array, initialized to zeros\n\nlong long fibonacci_memo(int n) {\n    if (n &amp;lt;= 1) {\n        return n;\n    }\n    \n    \/\/ Already calculated? Return stored result\n    if (memo&#x5B;n] != 0) {\n        return memo&#x5B;n];\n    }\n    \n    \/\/ Calculate and store\n    memo&#x5B;n] = fibonacci_memo(n-1) + fibonacci_memo(n-2);\n    return memo&#x5B;n];\n}\n\nint main() {\n    int terms;\n    printf(&quot;How many terms (max 92)? &quot;);\n    scanf(&quot;%d&quot;, &amp;amp;terms);\n    \n    printf(&quot;Fibonacci Series: &quot;);\n    for (int i = 0; i &amp;lt; terms; i++) {\n        printf(&quot;%lld &quot;, fibonacci_memo(i));\n    }\n    printf(&quot;\\n&quot;);\n    \n    return 0;\n}\n\n<\/pre><\/div>\n\n\n<p>This fixes the recursion by remembering previous results. Now it's O(n) instead of O(2^n).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"method-4-return-single-number\">Method 4: Return Single Number<\/h2>\n\n\n\n<p>Sometimes you just want the nth Fibonacci number:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n#include &amp;lt;stdio.h&gt;\n\nlong long fibonacci_single(int n) {\n    if (n &amp;lt;= 1) {\n        return n;\n    }\n    \n    long long prev = 0, curr = 1, temp;\n    \n    for (int i = 2; i &amp;lt;= n; i++) {\n        temp = prev + curr;\n        prev = curr;\n        curr = temp;\n    }\n    \n    return curr;\n}\n\nint main() {\n    int n;\n    printf(&quot;Which Fibonacci number do you want? &quot;);\n    scanf(&quot;%d&quot;, &amp;amp;n);\n    \n    if (n &amp;lt; 0) {\n        printf(&quot;Please enter a non-negative number.\\n&quot;);\n        return 1;\n    }\n    \n    printf(&quot;F(%d) = %lld\\n&quot;, n, fibonacci_single(n));\n    return 0;\n}\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"performance-comparison\">Performance Comparison<\/h2>\n\n\n\n<p>I tested these on my computer with n=40:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Method<\/th><th>Time<\/th><th>Memory Usage<\/th><\/tr><\/thead><tbody><tr><td>Simple loop<\/td><td>Instant<\/td><td>Very low<\/td><\/tr><tr><td>Basic recursion<\/td><td>30+ seconds<\/td><td>High (stack)<\/td><\/tr><tr><td>Memoized recursion<\/td><td>Instant<\/td><td>Medium<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The loop version is almost always your best bet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"common-pitfalls\">Common Pitfalls<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"integer-overflow\">Integer Overflow<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n\/\/ DON&#039;T do this - will overflow quickly\nint fib = fibonacci(50); \n\n\/\/ DO this instead\nlong long fib = fibonacci(50);\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"array-bounds\">Array Bounds<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n\/\/ Dangerous - no bounds checking\nlong long memo&#x5B;100];\nreturn memo&#x5B;n]; \/\/ What if n &gt; 99?\n\n\/\/ Better - check bounds first\nif (n &gt;= 100) {\n    printf(&quot;Number too large for our array\\n&quot;);\n    return -1;\n}\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"forgetting-base-cases\">Forgetting Base Cases<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n\/\/ This will crash - infinite recursion\nlong long bad_fib(int n) {\n    return bad_fib(n-1) + bad_fib(n-2); \/\/ No stopping condition!\n}\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"real-world-tips\">Real-World Tips<\/h2>\n\n\n\n<p>For homework: Use the simple loop. It's fast and shows you understand efficiency.<\/p>\n\n\n\n<p>For interviews: Start with the loop, then explain why basic recursion is slow, then show the memoized version if they ask.<\/p>\n\n\n\n<p>For production code: Definitely use the loop. It's reliable and fast.<\/p>\n\n\n\n<p>Testing your code:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n\/\/ These should work:\n\/\/ F(0) = 0\n\/\/ F(1) = 1  \n\/\/ F(10) = 55\n\/\/ F(20) = 6765\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"quick-questions\">Quick Questions<\/h2>\n\n\n\n<p><strong>Why do big Fibonacci numbers turn negative?<\/strong><br>Integer overflow. The number got too big for the data type. Use <code>long long<\/code> instead of <code>int<\/code>.<\/p>\n\n\n\n<p><strong>Which method should I memorize?<\/strong><br>The simple loop version. It handles 90% of situations and runs fast.<\/p>\n\n\n\n<p><strong>What about really huge Fibonacci numbers?<\/strong><br>You'd need a library for arbitrary-precision arithmetic. Standard C data types max out around F(92).<\/p>\n\n\n\n<p><strong>Any gotchas for beginners?<\/strong><br>Watch your array bounds if using memoization. And remember that C doesn't initialize arrays to zero automatically (except globals).<\/p>\n\n\n\n<p>The loop method is fast, simple, and works reliably. Master that one first, then learn the others for understanding different programming techniques.<\/p>\n\n\n\n<p><strong>Also Read:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/c-interview-questions\/\">C Interview Questions and Answers<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/data-structures-using-c\/\">Data Structures using C<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/armstrong-number-in-c\/\">Armstrong Number in C<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/top-c-projects\/\">Top C Projects<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-java\/\">Fibonacci Series in Java<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/\">Fibonacci Series in C<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Fibonacci in C shows up in programming classes and job interviews. It's perfect for learning loops, recursion, and why some code runs fast while other code crawls. C makes the performance differences really obvious. Write it wrong and you'll wait forever for results. Write it right and it runs instantly. That's a valuable lesson. What's [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":111385,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[36889],"content_type":[],"class_list":["post-70674","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-c-programming-2"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Fibonacci Series In C<\/title>\n<meta name=\"description\" content=\"Learn all about Fibonacci Series in C and learn to write a program to display the Fibonacci sequence in this blog.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C Program To Display Fibonacci Sequence\" \/>\n<meta property=\"og:description\" content=\"Learn all about Fibonacci Series in C and learn to write a program to display the Fibonacci sequence in this blog.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-06T07:35:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-26T05:35:47+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1408\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"C Program To Display Fibonacci Sequence\",\"datePublished\":\"2022-06-06T07:35:50+00:00\",\"dateModified\":\"2025-09-26T05:35:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/\"},\"wordCount\":490,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/fibonacci-series-c.webp\",\"keywords\":[\"C Programming\"],\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/\",\"name\":\"Fibonacci Series In C\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/fibonacci-series-c.webp\",\"datePublished\":\"2022-06-06T07:35:50+00:00\",\"dateModified\":\"2025-09-26T05:35:47+00:00\",\"description\":\"Learn all about Fibonacci Series in C and learn to write a program to display the Fibonacci sequence in this blog.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/fibonacci-series-c.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/fibonacci-series-c.webp\",\"width\":1408,\"height\":768,\"caption\":\"Fibonacci Series In C\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/fibonacci-series-in-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IT\\\/Software Development\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/software\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"C Program To Display Fibonacci Sequence\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Fibonacci Series In C","description":"Learn all about Fibonacci Series in C and learn to write a program to display the Fibonacci sequence in this blog.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/","og_locale":"en_US","og_type":"article","og_title":"C Program To Display Fibonacci Sequence","og_description":"Learn all about Fibonacci Series in C and learn to write a program to display the Fibonacci sequence in this blog.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2022-06-06T07:35:50+00:00","article_modified_time":"2025-09-26T05:35:47+00:00","og_image":[{"width":1408,"height":768,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp","type":"image\/webp"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"C Program To Display Fibonacci Sequence","datePublished":"2022-06-06T07:35:50+00:00","dateModified":"2025-09-26T05:35:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/"},"wordCount":490,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp","keywords":["C Programming"],"articleSection":["IT\/Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/","url":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/","name":"Fibonacci Series In C","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp","datePublished":"2022-06-06T07:35:50+00:00","dateModified":"2025-09-26T05:35:47+00:00","description":"Learn all about Fibonacci Series in C and learn to write a program to display the Fibonacci sequence in this blog.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp","width":1408,"height":768,"caption":"Fibonacci Series In C"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IT\/Software Development","item":"https:\/\/www.mygreatlearning.com\/blog\/software\/"},{"@type":"ListItem","position":3,"name":"C Program To Display Fibonacci Sequence"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp",1408,768,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-150x150.webp",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-300x164.webp",300,164,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-768x419.webp",768,419,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-1024x559.webp",1024,559,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp",1408,768,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c.webp",1408,768,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-640x768.webp",640,768,true],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-96x96.webp",96,96,true],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/fibonacci-series-c-150x82.webp",150,82,true]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Fibonacci in C shows up in programming classes and job interviews. It's perfect for learning loops, recursion, and why some code runs fast while other code crawls. C makes the performance differences really obvious. Write it wrong and you'll wait forever for results. Write it right and it runs instantly. That's a valuable lesson. What's&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/70674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=70674"}],"version-history":[{"count":13,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/70674\/revisions"}],"predecessor-version":[{"id":112339,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/70674\/revisions\/112339"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/111385"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=70674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=70674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=70674"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=70674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}