{"id":52777,"date":"2025-06-28T12:09:33","date_gmt":"2025-06-28T06:39:33","guid":{"rendered":"https:\/\/www.iquanta.in\/blog\/?p=52777"},"modified":"2025-06-28T12:11:55","modified_gmt":"2025-06-28T06:41:55","slug":"program-to-print-pascals-triangle","status":"publish","type":"post","link":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/","title":{"rendered":"Program to Print Pascal&#8217;s Triangle"},"content":{"rendered":"\n<p>Pascal&#8217;s Triangle is a triangular array of numbers that amaze mathematicians or developers for so long. This concept is really important when it comes for programming or developing other problems solution. <br>Each number in the triangle is the sum of two directly above it. It is not just helpful in concepts like binomial coefficients but it is also works in practical applications like algebra, geometry, trigonometry, and especially in computer science while performing programming language. In this blog we will be talking about the program to print Pascal&#8217;s triangle in Python, C++, C as well as in Java. <\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_77 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#What_is_Pascals_Triangle\" >What is Pascal&#8217;s Triangle?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#Program_to_Print_Pascals_Triangle_in_Python\" >Program to Print Pascal&#8217;s Triangle in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#Write_a_Program_to_print_Pascals_Triangle_in_Java\" >Write a Program to print Pascal&#8217;s Triangle in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#Write_a_Program_to_print_Pascals_Triangle_in_C\" >Write a Program to print Pascal&#8217;s Triangle in C++<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#What_is_Pascals_Triangle_used_for\" >What is Pascal&#8217;s Triangle used for?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#How_do_I_generate_Pascals_Triangle_in_code\" >How do I generate Pascal&#8217;s Triangle in code?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#What_is_the_formula_used_in_Pascals_Triangle\" >What is the formula used in Pascal&#8217;s Triangle?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#What_is_the_time_complexity_of_generating_Pascals_Triangle\" >What is the time complexity of generating Pascal&#8217;s Triangle?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#Can_Pascals_Triangle_be_used_in_real_life\" >Can Pascal\u2019s Triangle be used in real life?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-pascal-s-triangle\"><span class=\"ez-toc-section\" id=\"What_is_Pascals_Triangle\"><\/span><strong>What is Pascal&#8217;s Triangle?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Pascal&#8217;s triangle is a <a href=\"https:\/\/www.iquanta.in\/blog\/array-in-data-structure-types-and-complexity-analysis\/\">array <\/a>of number but in triangular form where each number is the sum of two other numbers directly. The triangle i.e, pascal&#8217;s triangle begin with the single number that is 1. Each row starts and ends with a number 1 and every interior value of a triangle obtained by adding two other numbers. This mathematical property presents the structure of Pascal&#8217;s triangle. <br>This triangle has a deep interference in algebra, and also expands the binomial coefficients to represents the values inside the triangle where (a+b)^n is the expansion that needs to expand to fulfill the structural requirement of Pascal&#8217;s triangle. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"159\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-168.png\" alt=\"Pascal's Triangle\" class=\"wp-image-52761\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-168.png 1024w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-168-300x47.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-168-768x119.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-168-150x23.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-168-696x108.png 696w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-program-to-print-pascal-s-triangle-in-python\"><span class=\"ez-toc-section\" id=\"Program_to_Print_Pascals_Triangle_in_Python\"><\/span><strong>Program to Print Pascal&#8217;s Triangle in Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this section we will be talking about code in python programming language. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def generate_pascals_triangle(num_rows):\r\n    triangle = &#091;]\r\n    for i in range(num_rows):\r\n        row = &#091;1] * (i + 1)\r\n        for j in range(1, i):\r\n            row&#091;j] = triangle&#091;i-1]&#091;j-1] + triangle&#091;i-1]&#091;j]\r\n        triangle.append(row)\r\n    return triangle\r\n\r\ndef print_pascals_triangle(triangle):\r\n    num_rows = len(triangle)\r\n    for i in range(num_rows):\r\n        print(\" \" * (num_rows - i), end=\" \")\r\n        for value in triangle&#091;i]:\r\n            print(f\"{value} \", end=\"\")\r\n        print()\r\n\r\ndef save_to_file(triangle, filename=\"pascals_triangle.txt\"):\r\n    with open(filename, \"w\") as file:\r\n        num_rows = len(triangle)\r\n        for i in range(num_rows):\r\n            line = \" \" * (num_rows - i)\r\n            line += \" \".join(str(num) for num in triangle&#091;i])\r\n            file.write(line + \"\\n\")\r\n    print(f\"\\nPascal's Triangle saved to {filename}\")\r\n\r\ndef main():\r\n    try:\r\n        n = int(input(\"Enter the number of rows for Pascal's Triangle: \"))\r\n        if n &lt;= 0:\r\n            print(\"Please enter a positive integer.\")\r\n            return\r\n        triangle = generate_pascals_triangle(n)\r\n        print(\"\\nHere is your Pascal's Triangle:\\n\")\r\n        print_pascals_triangle(triangle)\r\n        save = input(\"\\nDo you want to save this triangle to a file? (yes\/no): \").strip().lower()\r\n        if save == 'yes':\r\n            save_to_file(triangle)\r\n    except ValueError:\r\n        print(\"Invalid input. Please enter a valid integer.\")\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-write-a-program-to-print-pascal-s-triangle-in-java\"><span class=\"ez-toc-section\" id=\"Write_a_Program_to_print_Pascals_Triangle_in_Java\"><\/span><strong>Write a Program to print Pascal&#8217;s Triangle in Java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img decoding=\"async\" width=\"1024\" height=\"159\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-169.png\" alt=\"\" class=\"wp-image-52813\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-169.png 1024w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-169-300x47.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-169-768x119.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-169-150x23.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-169-696x108.png 696w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n<pre class=\"wp-block-code\"><code>import java.util.Scanner;\r\n\r\npublic class PascalsTriangle {\r\n\r\n    public static void main(String&#091;] args) {\r\n        Scanner sc = new Scanner(System.in);\r\n        System.out.print(\"Enter the number of rows: \");\r\n        int rows = sc.nextInt();\r\n        printPascalsTriangle(rows);\r\n    }\r\n\r\n    public static void printPascalsTriangle(int n) {\r\n        for (int i = 0; i &lt; n; i++) {\r\n            \/\/ Print leading spaces\r\n            for (int space = 0; space &lt; n - i; space++) {\r\n                System.out.print(\" \");\r\n            }\r\n\r\n            int number = 1;\r\n            for (int j = 0; j &lt;= i; j++) {\r\n                System.out.print(number + \" \");\r\n                number = number * (i - j) \/ (j + 1); \/\/ Binomial Coefficient Formula\r\n            }\r\n            System.out.println();\r\n        }\r\n    }\r\n}\r<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-write-a-program-to-print-pascal-s-triangle-in-c\"><span class=\"ez-toc-section\" id=\"Write_a_Program_to_print_Pascals_Triangle_in_C\"><\/span><strong>Write a Program to print Pascal&#8217;s Triangle in C++<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nvoid printPascalsTriangle(int n) {\r\n    for (int i = 0; i &lt; n; i++) {\r\n        for (int space = 0; space &lt; n - i; space++) {\r\n            cout &lt;&lt; \" \";\r\n        }\r\n\r\n        int num = 1;\r\n        for (int j = 0; j &lt;= i; j++) {\r\n            cout &lt;&lt; num &lt;&lt; \" \";\r\n            num = num * (i - j) \/ (j + 1); \/\/ Binomial Coefficient Formula\r\n        }\r\n        cout &lt;&lt; endl;\r\n    }\r\n}\r\n\r\nint main() {\r\n    int rows;\r\n    cout &lt;&lt; \"Enter the number of rows: \";\r\n    cin &gt;&gt; rows;\r\n\r\n    printPascalsTriangle(rows);\r\n\r\n    return 0;\r\n}\r<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Pascal\u2019s Triangle is an easy and fun way to learn about patterns in math. It shows how numbers are added from the row above. You can use it in many areas like algebra, coding, and even games.<\/p>\n\n\n\n<p>In this blog, we saw how to create Pascal\u2019s Triangle using simple code. Whether you&#8217;re a beginner in programming or just love math, this triangle is a great example to practice logic and loops. Try changing the number of rows and see how the pattern grows.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img decoding=\"async\" width=\"1024\" height=\"159\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-170.png\" alt=\"\" class=\"wp-image-52814\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-170.png 1024w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-170-300x47.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-170-768x119.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-170-150x23.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-170-696x108.png 696w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-frequently-asked-questions\"><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span><strong>Frequently Asked Questions<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Pascals_Triangle_used_for\"><\/span><strong>What is Pascal&#8217;s Triangle used for?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can use Pascal\u2019s Triangle to solve problems in combinations, probability, and algebra. It also helps you spot number patterns and understand how small calculations build bigger ideas.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_do_I_generate_Pascals_Triangle_in_code\"><\/span><strong>How do I generate Pascal&#8217;s Triangle in code?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can easily create Pascal\u2019s Triangle in code by using loops or recursion. Start each row with 1, and then add two numbers from the row above to fill the rest. This approach makes it simple to build each row step by step.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_the_formula_used_in_Pascals_Triangle\"><\/span><strong>What is the formula used in Pascal&#8217;s Triangle?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Pascal\u2019s Triangle uses the combination formula: C(n, k) = n! \/ (k! * (n &#8211; k)!). This formula tells you the value at any spot in the triangle. You just need the row number and the position in that row.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_the_time_complexity_of_generating_Pascals_Triangle\"><\/span><strong>What is the time complexity of generating Pascal&#8217;s Triangle?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>When you build Pascal\u2019s Triangle, you go through every number in each row. So, the time it takes is O(n\u00b2), where \u2018n\u2019 is the number of rows. This is because you do one step for each value in the triangle.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Can_Pascals_Triangle_be_used_in_real_life\"><\/span><strong>Can Pascal\u2019s Triangle be used in real life?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Yes, definitely people use Pascal\u2019s Triangle in fields like computer science, data analysis, and architecture. It also shows up in games, art, and design. This triangle proves that math ideas can be useful and creative.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pascal&#8217;s Triangle is a triangular array of numbers that amaze mathematicians or developers for so long. This concept is really important when it comes for programming or developing other problems solution. Each number in the triangle is the sum of two directly above it. It is not just helpful in concepts like binomial coefficients but [&hellip;]<\/p>\n","protected":false},"author":560,"featured_media":52794,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1075,1073],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.4 (Yoast SEO v21.9.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Program to Print Pascal&#039;s Triangle - iQuanta<\/title>\n<meta name=\"description\" content=\"In this blog we will be talking about the program to print Pascal&#039;s triangle in Python, C++, C as well as in Java.\" \/>\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.iquanta.in\/blog\/program-to-print-pascals-triangle\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Program to Print Pascal&#039;s Triangle\" \/>\n<meta property=\"og:description\" content=\"In this blog we will be talking about the program to print Pascal&#039;s triangle in Python, C++, C as well as in Java.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/\" \/>\n<meta property=\"og:site_name\" content=\"iQuanta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/iquanta.in\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-28T06:39:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-28T06:41:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/Your-paragraph-text-58.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nidhi Goswami\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nidhi Goswami\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/\"},\"author\":{\"name\":\"Nidhi Goswami\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\"},\"headline\":\"Program to Print Pascal&#8217;s Triangle\",\"datePublished\":\"2025-06-28T06:39:33+00:00\",\"dateModified\":\"2025-06-28T06:41:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/\"},\"wordCount\":568,\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"articleSection\":[\"DSA and Competitive Programming\",\"iSkills\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/\",\"name\":\"Program to Print Pascal's Triangle - iQuanta\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\"},\"datePublished\":\"2025-06-28T06:39:33+00:00\",\"dateModified\":\"2025-06-28T06:41:55+00:00\",\"description\":\"In this blog we will be talking about the program to print Pascal's triangle in Python, C++, C as well as in Java.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.iquanta.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Program to Print Pascal&#8217;s Triangle\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"name\":\"iQuanta | Cat Preparation Online\",\"description\":\"Building Learning Networks\",\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\",\"name\":\"IQuanta\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"contentUrl\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"width\":525,\"height\":200,\"caption\":\"IQuanta\"},\"image\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/iquanta.in\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\",\"name\":\"Nidhi Goswami\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"caption\":\"Nidhi Goswami\"},\"url\":\"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Program to Print Pascal's Triangle - iQuanta","description":"In this blog we will be talking about the program to print Pascal's triangle in Python, C++, C as well as in Java.","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.iquanta.in\/blog\/program-to-print-pascals-triangle\/","og_locale":"en_US","og_type":"article","og_title":"Program to Print Pascal's Triangle","og_description":"In this blog we will be talking about the program to print Pascal's triangle in Python, C++, C as well as in Java.","og_url":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/","og_site_name":"iQuanta","article_publisher":"https:\/\/facebook.com\/iquanta.in","article_published_time":"2025-06-28T06:39:33+00:00","article_modified_time":"2025-06-28T06:41:55+00:00","og_image":[{"width":1600,"height":900,"url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/Your-paragraph-text-58.png","type":"image\/png"}],"author":"Nidhi Goswami","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nidhi Goswami","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#article","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/"},"author":{"name":"Nidhi Goswami","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3"},"headline":"Program to Print Pascal&#8217;s Triangle","datePublished":"2025-06-28T06:39:33+00:00","dateModified":"2025-06-28T06:41:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/"},"wordCount":568,"publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"articleSection":["DSA and Competitive Programming","iSkills"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/","url":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/","name":"Program to Print Pascal's Triangle - iQuanta","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/#website"},"datePublished":"2025-06-28T06:39:33+00:00","dateModified":"2025-06-28T06:41:55+00:00","description":"In this blog we will be talking about the program to print Pascal's triangle in Python, C++, C as well as in Java.","breadcrumb":{"@id":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.iquanta.in\/blog\/program-to-print-pascals-triangle\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.iquanta.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Program to Print Pascal&#8217;s Triangle"}]},{"@type":"WebSite","@id":"https:\/\/www.iquanta.in\/blog\/#website","url":"https:\/\/www.iquanta.in\/blog\/","name":"iQuanta | Cat Preparation Online","description":"Building Learning Networks","publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.iquanta.in\/blog\/#organization","name":"IQuanta","url":"https:\/\/www.iquanta.in\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","contentUrl":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","width":525,"height":200,"caption":"IQuanta"},"image":{"@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/iquanta.in"]},{"@type":"Person","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3","name":"Nidhi Goswami","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","caption":"Nidhi Goswami"},"url":"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/"}]}},"_links":{"self":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/52777"}],"collection":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/users\/560"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/comments?post=52777"}],"version-history":[{"count":5,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/52777\/revisions"}],"predecessor-version":[{"id":52815,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/52777\/revisions\/52815"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media\/52794"}],"wp:attachment":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media?parent=52777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/categories?post=52777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/tags?post=52777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}