<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8712552229034289053</atom:id><lastBuildDate>Tue, 08 Sep 2026 10:29:14 +0000</lastBuildDate><category>c questions</category><category>c pyramids</category><category>c basics</category><category>c program</category><category>dotcprograms</category><category>matrix questions in c</category><category>programming</category><category>string in c</category><category>datastructure</category><category>interview questions</category><category>pascal triangle in c</category><category>algorithm</category><category>c games</category><category>conditional operator in c</category><category>linked list</category><category>minimum spanning tree</category><category>unix</category><category>CLion</category><category>Eclipse</category><category>Netbeans</category><category>Visual Studio</category><category>Xcode</category><category>area of circles</category><category>array in c</category><category>arudino</category><category>author name</category><category>best c IDE</category><category>bisection method</category><category>blogger</category><category>c array programs</category><category>c tricks</category><category>campus</category><category>capitalize the string in c</category><category>change</category><category>chmod</category><category>commands</category><category>cprogram</category><category>dangling pointer</category><category>devc++</category><category>file</category><category>filesinc</category><category>gotoxy</category><category>java</category><category>keywords</category><category>kruskal&#39;s</category><category>kruskals</category><category>linkedlist</category><category>magicsquarebox</category><category>malloc in c</category><category>null pointer</category><category>numerical methods</category><category>operators</category><category>permission</category><category>placements</category><category>prim&#39;s algorithm</category><category>prims algorithm</category><category>programmers</category><category>python</category><category>recursion in c</category><category>robotics</category><category>smiley program</category><category>spiral matrix</category><category>string reverse prgram</category><category>strrev()</category><category>struct</category><category>structure</category><category>technology</category><category>tictactoe</category><title>C Programs</title><description>C Programs | C Questions | C Basics | C Pyramids | C Tricks | C Programmers</description><link>http://dotcprograms.blogspot.com/</link><managingEditor>noreply@blogger.com (Aditya Narayan Singh)</managingEditor><generator>Blogger</generator><openSearch:totalResults>107</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-768191389075694729</guid><pubDate>Sun, 26 Feb 2023 05:32:00 +0000</pubDate><atom:updated>2023-02-26T11:07:00.979+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">campus</category><category domain="http://www.blogger.com/atom/ns#">datastructure</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">placements</category><category domain="http://www.blogger.com/atom/ns#">python</category><title>Which language should be preferred for learning data structures considering campus placements?</title><description>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZTRYvcKxtLIBhkM2ai0ZRu_9NEBQieQkD-PfTrYshY2Nrxz0ELT-QAxi9g7RHoEc2onhFOypWd-LlDCYCGXnf1WMtB-M5p5_1rcoUlv7d0w5w1e5lk7xRumOkIgciGyN4UQizDyyoFcdwHs2lBiZI_auRhTVcfAZj7U-2Ce5rwiWGwNL5vRymjpF/s618/R.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;378&quot; data-original-width=&quot;618&quot; height=&quot;392&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZTRYvcKxtLIBhkM2ai0ZRu_9NEBQieQkD-PfTrYshY2Nrxz0ELT-QAxi9g7RHoEc2onhFOypWd-LlDCYCGXnf1WMtB-M5p5_1rcoUlv7d0w5w1e5lk7xRumOkIgciGyN4UQizDyyoFcdwHs2lBiZI_auRhTVcfAZj7U-2Ce5rwiWGwNL5vRymjpF/w640-h392/R.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, &amp;quot;Segoe UI&amp;quot;, Roboto, Ubuntu, Cantarell, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;&quot;&gt;When it comes to preparing for campus placements, one of the most important things that you can do is to learn about data structures. This is a crucial topic that is often covered in technical interviews, and it can be the difference between getting the job of your dreams or missing out. However, with so many different programming languages available, it can be difficult to know which one you should focus on when learning about data structures. In this blog post, we&#39;ll take a closer look at some of the most popular programming languages and discuss which one is best for learning data structures.&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, &amp;quot;Segoe UI&amp;quot;, Roboto, Ubuntu, Cantarell, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;&quot;&gt;The first programming language that comes to mind when discussing data structures is undoubtedly C. &lt;b&gt;C is a powerful and efficient language&lt;/b&gt; that is widely used in the industry for system programming and embedded systems. It&#39;s also the language that most computer science courses use to teach data structures, so it&#39;s a good starting point for beginners. The downside of C is that it&#39;s a bit more difficult to learn than some other languages, and it can take some time to get the hang of pointers and memory allocation.&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, &amp;quot;Segoe UI&amp;quot;, Roboto, Ubuntu, Cantarell, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;&quot;&gt;Another popular language for data structures is Java. &lt;b&gt;Java is a high-level language that is often used for developing enterprise-level applications.&lt;/b&gt; It&#39;s also an excellent language for learning data structures because of its strong object-oriented programming paradigm. Java&#39;s syntax is relatively easy to read and write, making it an excellent choice for beginners. Moreover, Java provides a vast collection of built-in data structures like ArrayList, LinkedList, and HashSet, making it easier for learners to focus on the core concepts rather than implementing data structures from scratch.&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, &amp;quot;Segoe UI&amp;quot;, Roboto, Ubuntu, Cantarell, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Python is another language that has gained popularity in recent years. &lt;/b&gt;It&#39;s a high-level language that is easy to read and write and is widely used in the data science community. While Python may not be the fastest language, it is often used for prototyping and rapid development. Python also provides a vast collection of built-in data structures and libraries like NumPy, Pandas, and SciPy that make it easy to work with data.&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(217, 217, 227); box-sizing: border-box; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, &amp;quot;Segoe UI&amp;quot;, Roboto, Ubuntu, Cantarell, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; margin: 1.25em 0px 0px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;In conclusion, all three languages (C, Java, and Python) are excellent choices for learning data structures. While C may be more challenging to learn, it provides an excellent foundation for understanding how data structures work at a lower level. Java, on the other hand, is an excellent choice for beginners because of its easy-to-read syntax and built-in data structures. Python is the easiest to learn among the three and offers a plethora of built-in data structures and libraries for handling data.&lt;/b&gt; Ultimately, the choice of programming language comes down to your personal preference and career goals.&lt;/p&gt;</description><link>http://dotcprograms.blogspot.com/2023/02/which-language-should-be-preferred-for.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZTRYvcKxtLIBhkM2ai0ZRu_9NEBQieQkD-PfTrYshY2Nrxz0ELT-QAxi9g7RHoEc2onhFOypWd-LlDCYCGXnf1WMtB-M5p5_1rcoUlv7d0w5w1e5lk7xRumOkIgciGyN4UQizDyyoFcdwHs2lBiZI_auRhTVcfAZj7U-2Ce5rwiWGwNL5vRymjpF/s72-w640-h392-c/R.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-2009169164501654226</guid><pubDate>Fri, 05 Feb 2021 11:55:00 +0000</pubDate><atom:updated>2021-08-22T10:45:48.056+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algorithm</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">linkedlist</category><category domain="http://www.blogger.com/atom/ns#">struct</category><title>C program to implement linked list using struct</title><description>Structure in C programming language is a composite data type that can hold variables of more than one data type and keyword&lt;b style=&quot;background-color: #fcff01;&quot;&gt; struct &lt;/b&gt;&lt;span style=&quot;background-color: white;&quot;&gt;is use to declare structure in C.&lt;/span&gt;&lt;div&gt;&lt;b style=&quot;background-color: #fcff01;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Syntax to define struct in C programming language is as:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;c language-clike&quot; style=&quot;background: rgb(30, 42, 55); border-radius: 0.3em; box-sizing: border-box; color: #f8f8f2; font-size: 16px; hyphens: none; line-height: 1.5; margin-bottom: 15px; margin-top: 15px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 1em; tab-size: 4; text-shadow: rgba(0, 0, 0, 0.3) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-clike&quot; style=&quot;background: 0px 0px; border-radius: 0px; box-sizing: border-box; font-size: 1em; hyphens: none; line-height: 1.5; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgba(0, 0, 0, 0.3) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;struct &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;[&lt;/span&gt;structure_tag&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot; style=&quot;box-sizing: border-box; color: slategrey;&quot;&gt;//datatype variable 1&lt;/span&gt;
    &lt;span class=&quot;token comment&quot; style=&quot;box-sizing: border-box; color: slategrey;&quot;&gt;//int x;&lt;/span&gt;
    &lt;span class=&quot;token comment&quot; style=&quot;box-sizing: border-box; color: slategrey;&quot;&gt;//char s;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;[&lt;/span&gt;structure_variables&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box;&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;I will assume that you know how to implement struct normally in C programming language because here I am going to cover how to implement struct using&lt;/span&gt;&lt;b style=&quot;background-color: #fcff01;&quot;&gt; linked list&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;C Program for struct using linked list:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #011627; color: #d6deeb; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;stdlib.h&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;...............................................Function Creation...........................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;createlinkedlist&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;display&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;insert_at_first&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_from_first&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_from_end&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;insert_at_selected_position&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_entire_list&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;reverse_nodes&lt;/span&gt;();&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;.........................................structure node...............................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; roll;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;char&lt;/span&gt; name[&lt;span style=&quot;color: #f78c6c;&quot;&gt;30&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;next;&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;head;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;......................................................MAIN..............................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; ch;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\n\n\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;1.Create Linked list&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;2.Display List&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(head&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;3.Delete From First&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;4.Delete From end&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;5.Insert at first&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;6.Insert at selected position&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;7.Delete entire List&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;8.Reverse List&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;9.Exit&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;ch);&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;switch&lt;/span&gt;(ch)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;createlinkedlist&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;9&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;exit&lt;/span&gt; (&lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;5&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;insert_at_first&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;3&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_from_first&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;4&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_from_end&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;6&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;insert_at_selected_position&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;7&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_entire_list&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;8&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;reverse_list&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;default&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Wrong choice Try again......&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    }&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;while&lt;/span&gt;(ch&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;3&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;............................................Create linked list.................................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;createlinkedlist&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;newnode,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp;&lt;/div&gt;&lt;div&gt;    newnode&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;(&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;)&lt;span style=&quot;color: #c5e478;&quot;&gt;malloc&lt;/span&gt;(&lt;span style=&quot;color: #7fdbca;&quot;&gt;sizeof&lt;/span&gt;(&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node));&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Roll :  &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;newnode-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;roll&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Name :  &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;newnode-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;name&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    newnode-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(head&lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        head&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;newnode;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;while&lt;/span&gt;(temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;newnode;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt; ......................................................DISPLAY............................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;display&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Roll&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(head&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;temp&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;;temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t\t&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;roll&lt;/span&gt;,temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;name&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;List is empty Boss... &lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;,&lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;............................................Insert At FIrst.................................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;insert_at_first&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;newnode;&lt;/div&gt;&lt;div&gt;    newnode&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;(&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; student &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;)&lt;span style=&quot;color: #c5e478;&quot;&gt;malloc&lt;/span&gt;(&lt;span style=&quot;color: #7fdbca;&quot;&gt;sizeof&lt;/span&gt;(&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node));&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Roll :  &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;newnode-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;roll&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Name :  &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;newnode-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;name&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;div&gt;    head&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;newnode;&lt;/div&gt;&lt;div&gt;    newnode-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;..............................................Delete from first.....................................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_from_first&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(head&lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;List is empty Boss... &lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;,&lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;free&lt;/span&gt;(head);&lt;/div&gt;&lt;div&gt;        head&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;First list deleted from node...&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;..............................................Delete from end................................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_from_end&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;newtemp;&lt;/div&gt;&lt;div&gt;    temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;while&lt;/span&gt;(temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        newtemp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp;&lt;/div&gt;&lt;div&gt;        temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;            newtemp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;free&lt;/span&gt;(temp);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Last node is deleted....&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;..................................................Insert at selected position....................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;insert_at_selected_position&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;new_temp,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp_copy;&lt;/div&gt;&lt;div&gt;    temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; position,i;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Enter the roll before you want to insert&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;position);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(i&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;;i&lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt;position;i&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    temp_copy&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    new_temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;(&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;)&lt;span style=&quot;color: #c5e478;&quot;&gt;malloc&lt;/span&gt;(&lt;span style=&quot;color: #7fdbca;&quot;&gt;sizeof&lt;/span&gt;(&lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node));&lt;/div&gt;&lt;div&gt;    temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;new_temp;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Roll :  &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;new_temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;roll&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t\t\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Name :  &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;new_temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;name&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    new_temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp_copy;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;..................................................free entire list........................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;delete_entire_list&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;temp,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;had;&lt;/div&gt;&lt;div&gt;    temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;free&lt;/span&gt;(temp);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;while&lt;/span&gt;(temp&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        had&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp;&lt;/div&gt;&lt;div&gt;        temp&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;temp-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;free&lt;/span&gt;(had);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    head&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;.......................................Reverse List....................................//&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;reverse_list&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;system&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(head-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n\t&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;sorry BOSS &lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt; reverse not possible...&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;p1,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;p2,&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;p3;&lt;/div&gt;&lt;div&gt;    p1&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;head;&lt;/div&gt;&lt;div&gt;    p2&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p1-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    p3&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p1-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    p1-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;while&lt;/span&gt;(p3&lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;NULL&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        p2-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p1;&lt;/div&gt;&lt;div&gt;        p1&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p2;&lt;/div&gt;&lt;div&gt;        p2&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p3;&lt;/div&gt;&lt;div&gt;        p3&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p3-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    p2-&amp;gt;&lt;span style=&quot;color: #c5e478;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p1;&lt;/div&gt;&lt;div&gt;    head&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;p2;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://dotcprograms.blogspot.com/2021/02/c-program-to-implement-structure-using.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-5504452528504182784</guid><pubDate>Sat, 16 Jun 2018 04:06:00 +0000</pubDate><atom:updated>2018-06-16T09:36:43.252+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">programmers</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">technology</category><title>5 Tips we should follow to learn programming languages faster and better</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
Are you assessing for a diploma in computer system technological 
expertise? Or are you looking for to emerge as a coding or establishing 
professional? Irrespective of just what your cause is, you could have to
 grasp your art work of coding and also this will need by no 
means-finishing war to your component. Given below are 5 tips to assist 
you examine shows as speedy as possible.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot; /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 8px; margin-left: 0.5px; margin-right: 0.5px; orphans: 2; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;tbody style=&quot;margin-bottom: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
&lt;tr style=&quot;margin-bottom: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY9T6FfHXOy_IaycKyS4ki6ve7S4-NS-O4tm_D22G-QNkxS0_WBiVsdspznwUxipUa4NocfFoBby6In4Z2YufD6gRw7DVm69MqXUPKFE3BFDLUEybQeRGXd6hpiYabF0MMaFZB80SIl7ZR/s1600/Become-Self-Taught-Programmer-Featured-670x335.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;335&quot; data-original-width=&quot;670&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY9T6FfHXOy_IaycKyS4ki6ve7S4-NS-O4tm_D22G-QNkxS0_WBiVsdspznwUxipUa4NocfFoBby6In4Z2YufD6gRw7DVm69MqXUPKFE3BFDLUEybQeRGXd6hpiYabF0MMaFZB80SIl7ZR/s640/Become-Self-Taught-Programmer-Featured-670x335.jpg&quot; style=&quot;cursor: move;&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;margin-bottom: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;font-size: 12.8px; padding-top: 4px; text-align: center;&quot;&gt;image courtesy: makeuseof&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 18.73px; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
1. Study with the aid of doing&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
If you need to research the coding principles quicker, you need to 
have fun with the codes on a day by day structure. Even the handiest 
codes will certainly be extremely challenging to put in force for the 
primary time. Honestly, setting boils down to exercise. In case you do 
not work out sufficient, you might not be capable of get it proper. 
Within the start, hand-operated coding will certainly take you a lot of 
time, but transformeds into a great deal easier with the flow of time.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 18.73px; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
2. Draw close the principles&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
At first, the basics of programming will certainly appear so smooth 
to you. Nonetheless this is not true. What you have to do is nail the 
fundamentals and also you ought to do it nicely. As a rely of fact, the 
far better you grasp the principles, the less challenging it will likely
 be so about check out the superior standards. If you do not research 
the essentials, you might get stuck whilst obtaining understanding of 
the higher innovative points.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 18.73px; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
3. Code by way of hand&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
Nowadays, computer monitors are getting thinner and also hard drivers
 have ended up being lighter. Yet, guide coding remains to be just one 
of the top techniques in case you should discover coding. Whether you 
run a notebook or whiteboard, overview coding requires extra accuracy, 
reason and also caution. Whilst it takes more time, this limit is going 
to mold you right into an expert programmer.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 18.73px; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
4. Request for assistance&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
If you ask peer as well as advisors for help, you’ll can take a look 
at quicker. If you believe that you cannot find out a subject otherwise 
you can not stream a bug, you’re fallacious. With a pair of eyes or help
 from other expert, you might make it possible. What you need to do is 
forget about the trolls as well as flip to experts for assistance. 
Professionals have been additionally novices like you, to make sure that
 they assist you to with the issues.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 18.73px; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
5. Online possessions&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
Ultimately, in case you recognize a picked idea, that includes a 
textbook principle, you may intend to preserve your self assurance phase
 as well as look for on line possessions for researching the same 
principle. Not all people discovers the equivalent manner. If one supply
 doesn’t be ideal for you, does not suggest you have actually got an 
inconvenience internal you. At the web, you can uncover endless 
possessions for acquiring understanding of shows. On video sharing 
internet sites like youtube, you might view splendid tutorials so one 
can analyze at your personal speed. The movie are easy to acknowledge 
and assist you grade by grade during the direction.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
So, when you have actually been searching for a means to evaluate the
 art work of programming quicker, we encourage which you try out the 
tips given up this post. For better assist, you might connect with a 
professional designer. You want to work difficult and practice on a 
normal foundation.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: black; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;b style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/b&gt;&lt;i style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/i&gt;&lt;u style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/u&gt;&lt;sub style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/sub&gt;&lt;sup style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/sup&gt;&lt;strike style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/strike&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot; /&gt;&lt;/div&gt;
&lt;b&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;u&gt;&lt;/u&gt;&lt;sub&gt;&lt;/sub&gt;&lt;sup&gt;&lt;/sup&gt;&lt;strike&gt;&lt;/strike&gt;&lt;br /&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/06/5-tips-we-should-follow-to-learn.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY9T6FfHXOy_IaycKyS4ki6ve7S4-NS-O4tm_D22G-QNkxS0_WBiVsdspznwUxipUa4NocfFoBby6In4Z2YufD6gRw7DVm69MqXUPKFE3BFDLUEybQeRGXd6hpiYabF0MMaFZB80SIl7ZR/s72-c/Become-Self-Taught-Programmer-Featured-670x335.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-9056702219633865164</guid><pubDate>Sat, 26 May 2018 11:21:00 +0000</pubDate><atom:updated>2018-05-26T16:51:27.968+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">commands</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">unix</category><title>Most used UNIX commands</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHRIdMNVeftXF6lqBfPunU6bB6sdpZdv0KDYV1XEund8TJq4lFEZrdAPzjU8WwcoBImOfvgkE8Mf2m-gjItkozcD8HLXKe927wiW4Sh4grV5I58IvNpBj5igHWu6XAl2PgALpsf4JzfWY/s1600/linuxlearners.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;664&quot; data-original-width=&quot;1268&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHRIdMNVeftXF6lqBfPunU6bB6sdpZdv0KDYV1XEund8TJq4lFEZrdAPzjU8WwcoBImOfvgkE8Mf2m-gjItkozcD8HLXKe927wiW4Sh4grV5I58IvNpBj5igHWu6XAl2PgALpsf4JzfWY/s640/linuxlearners.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;ls Commands (list) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;ls&amp;nbsp;: list the files&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -a&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: list the hidden files&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -al&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: list the hidden files with long formatting&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -R&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: list the recursive directory tree&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -t&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: list the files with time&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -s&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: list the file size&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -i&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: list the file size with index number&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -ls&amp;nbsp;: size with long format&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -X&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: extension name&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls -S&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: sort by file size&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;cd Command (change directory) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;cd /&amp;nbsp;: move to root directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd ~&amp;nbsp;: move to home directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd ..&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: go back one step&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd ~/directory&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: jump from one directory to another directly&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd /root/directory&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: absolute path of directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd directory&amp;nbsp;: Relative path of directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd dir1/dir2&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: moving directly to dir2 inside the dir1.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd&amp;nbsp;: move directly to the home directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cd ~prakash&amp;nbsp;: takes to other user login&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;pwd Commands (print working directory) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;pwd&amp;nbsp;: print the working directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;/bin/pwd –version&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: print the version of pwd command&lt;/li&gt;
&lt;li&gt;&amp;nbsp;type -a pwd&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: print all the locations containing executable named pwd&lt;/li&gt;
&lt;li&gt;&amp;nbsp;PS1=’pwd&amp;gt;’&amp;nbsp;: change current working directory to anything&lt;/li&gt;
&lt;li&gt;&amp;nbsp;nano pwd.sh&amp;nbsp;: create a shell script&lt;/li&gt;
&lt;li&gt;&amp;nbsp;chmod pwd.sh&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: give executive permission&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;mkdir commands (make directory):&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;mkdir dirname&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create a new directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mkdir -m a=rwx dirname&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create a new directory and set permissions&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mkdir -p /root/mine/a/b&amp;nbsp;: create a specified intermediate directories&amp;nbsp;to verify this “du mine”&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mkdir –version&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: shows the version of the installed mkdir&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mkdir -m 777 mine&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create a new directory and set the permission as per numbers&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;rm commands(remove) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;rm file1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: delete the file1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rm -r dir1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: delete the dir1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rm -f file1&amp;nbsp;: delete the file1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rm -rf dir1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: force remove the dir1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rm file1 file2 file3&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: delete the 3 files simultaneously&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rmdir dir1 dir2 dir3&amp;nbsp;: delete the 3 directories simultaneously&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rm -ri dir1&amp;nbsp;: delete file and sub directories interactively(-ri option in rm cmd)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;rm -f *.txt&amp;nbsp;: delete all the .txt file&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;cp commands (copy) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;cp file1 file2&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: copy file1 to file2&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cp -r dir1 dir2&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: copy dir1 to dir2&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cp *.txt dir1&amp;nbsp;: copy and move all the .txt files to dir1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cp -f file.txt dir1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: force file copy to dir1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cp -i file.txt dir1&amp;nbsp;: interactive prompt before file overwrite&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cp -u * dirname&amp;nbsp;: copy all the files to the directory&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;mv command (move) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;mv file1 file2&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: rename the file1 to file2&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mv file1 dir1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: move the file1 to the destination directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mv file1 ../&amp;nbsp;: move the file1 to the root directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mv *.txt dir 1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: move the all .txt files to dir1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mv dir1/* .&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: move all files in the subdirectory dir1 to current directory&lt;/li&gt;
&lt;li&gt;&amp;nbsp;mv dir1 dir2&amp;nbsp;: move the dir1 to dir2&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;ln Commands (link) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;ln -s file1 dirname&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create a symbolic link “link” to file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ln -s file1 file2&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create a symbolic link to a files&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ln -s -b file1.txt file2.txt&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: file1.txt is renamed to file2.txt , file2.txt symlink is created&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;touch command :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;touch file1&amp;nbsp;: create a new file1&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch file1 file2 file3&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create multiple files simultaneously&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch -a test.txt&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: change file access and modification&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch -c test.txt&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: avoid creating new file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch -m test.txt&amp;nbsp;: change file modification time&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch {A..Z} &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create file with names A to Z&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch {1..20&amp;nbsp;: Create files with name 1 to 10&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch {A..N}.txt&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create file with extension&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch {1..10}{1..1000}&amp;nbsp;: create 10k files&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch -c -t 12101730 test.txt&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: set the access and modification times&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch -r file &amp;nbsp;leena&amp;nbsp;: use time stamp of another file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;touch -d ’14:24′ abc.txt ”&amp;nbsp;: specify datetime as a string&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;cat command (concatenate) :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;ct /etc/shells&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: display all the shell commands&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat /etc/passwd&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: display contents of file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat file file1&amp;nbsp;: view contents of multiple files&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat &amp;gt;test1&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: create a file with cat command&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat file.txt | more&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: use cat command with more option&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat file.txt | less&amp;nbsp;: use cat command with less option&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat -n file.txt&amp;nbsp;: display numbers in file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat -e file&amp;nbsp;: display $ at the EOF&lt;/li&gt;
&lt;li&gt;&amp;nbsp;cat file1; file2 file3;&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: diplay multiple file contents simultaneously more command :&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;more command :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;more +3 file1.txt&amp;nbsp;: display the contents of file1.txt , beginning at line 3&lt;/li&gt;
&lt;li&gt;&amp;nbsp;more +/”hope” file&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: display the content of the file , &amp;nbsp;beginning at the first line containing the string “hope”.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;ls | more&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: List the contents of the current directory with ls, using more to display the list one screen at a time.&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;head commands :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;head test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: print the first 10 lines from the files&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -n2 test&amp;nbsp;: &amp;nbsp;print the first N lines from the file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -n -2 test&amp;nbsp;: Skip the last N lines from the file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -c 5 test&amp;nbsp;: print the first N bytes from the file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -c -7 test&amp;nbsp;: to skip printing last N bytes&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -n 10 test | tail -5&amp;nbsp;: Print the lines b/w the line numbers M and N&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -n 2 /etc/passwd&amp;nbsp;: print the first 2 lines of a file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;head -n -27 /etc/passwd&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: &amp;nbsp;it printed all the lines starting after the line 27&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;tail commands :&lt;/strong&gt;&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&amp;nbsp;tail test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: print the last 10 lines of the file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail test -n 100&amp;nbsp;: Outputs the last 100 lines of the file myfile.txt&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail -n 2 /etc/passwd&amp;nbsp;: print the last 2 lines of a file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail -n-2 test&amp;nbsp;: Print the last N lines from the file&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail -f test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: &amp;nbsp;output the contents of file as it grows, starting with the last 10 lines Process Management&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail -c-7 test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: print the last N bytes&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail -n10 test | head -5&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: Print the lines b/w the line numbers M and N&lt;/li&gt;
&lt;li&gt;&amp;nbsp;tail -n -27 /etc/passwd&amp;nbsp;: &amp;nbsp;it printed all the lines starting before the line 27&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;u&gt;&lt;/u&gt;&lt;sub&gt;&lt;/sub&gt;&lt;sup&gt;&lt;/sup&gt;&lt;strike&gt;&lt;/strike&gt;&lt;br /&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/05/unix-commands.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHRIdMNVeftXF6lqBfPunU6bB6sdpZdv0KDYV1XEund8TJq4lFEZrdAPzjU8WwcoBImOfvgkE8Mf2m-gjItkozcD8HLXKe927wiW4Sh4grV5I58IvNpBj5igHWu6XAl2PgALpsf4JzfWY/s72-c/linuxlearners.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-8250835593075118178</guid><pubDate>Sat, 26 May 2018 11:19:00 +0000</pubDate><atom:updated>2018-05-26T16:49:04.942+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">chmod</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">file</category><category domain="http://www.blogger.com/atom/ns#">permission</category><category domain="http://www.blogger.com/atom/ns#">unix</category><title>chmod in  UNIX</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2&gt;
Commands for changing Premission in UNIX:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy26GSIYMXZSfMD59_fXyPsfKMTUkkIsycoPKPuRO92Vf7zuUHr_tXFvH18YDhV4qUECdLuHpJtxz4gX_n_bTvlKz3PyhvEDsdJCx5j_z04dY2akGH3w1ZcPmVqgFDr16lBuU0nOw8lUA/s1600/linuxlearners.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;664&quot; data-original-width=&quot;1268&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy26GSIYMXZSfMD59_fXyPsfKMTUkkIsycoPKPuRO92Vf7zuUHr_tXFvH18YDhV4qUECdLuHpJtxz4gX_n_bTvlKz3PyhvEDsdJCx5j_z04dY2akGH3w1ZcPmVqgFDr16lBuU0nOw8lUA/s640/linuxlearners.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
chmod octal file – change the permissions of file to octal, which can be found separately for user, group, and world by adding:&lt;br /&gt;
&lt;br /&gt;


&lt;b&gt;4 – read (r)&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;2 – write (w)&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;1 – execute (x)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;


&lt;h3 style=&quot;text-align: left;&quot;&gt;
chmod commands :&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/h3&gt;
&amp;gt; chmod 400 test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: Making read only file for user&lt;br /&gt;


&amp;gt; chmod 777 dir1/&amp;nbsp;: Change file permissions and give all permissions for&amp;nbsp;all user+group_other(file/directory)&lt;br /&gt;


&amp;gt; chmod u+w test&amp;nbsp;: Change permissions only for user, group or others&lt;br /&gt;


&amp;gt; chmod g+w dir1/&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: Change permissions only for Directories&lt;br /&gt;


&amp;gt; chmod u-w test&amp;nbsp;: To remove file permission using (symbolic mode)&amp;nbsp;chmod command&lt;br /&gt;


&amp;gt; chmod 555 test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: &amp;nbsp;To remove file permission using (octal mode) chmod&amp;nbsp;command&lt;br /&gt;


&amp;gt; chmod u-rw test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: To remove read and write access from file for&amp;nbsp;user/group/others with symbolic(file/directory)&lt;br /&gt;


&amp;gt; chmod a-rw test&amp;nbsp;: To remove read and write access from file for all with&amp;nbsp;symbolic(file/directory)&lt;br /&gt;


&amp;gt; chmod a=X 8&amp;nbsp;: Setting execute permission only on directories&amp;nbsp;without touching files(chmod a+X *)&lt;br /&gt;


&amp;gt; chmod –reference test perk : To copy permission from one file to another&amp;nbsp;(source_file destination_file)&lt;br /&gt;


&amp;gt; chmod u+r,g+w,o+x test&lt;span class=&quot;Apple-tab-span&quot;&gt;&amp;nbsp;&lt;/span&gt;: Changing multiple permissions in a file/directory&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;u&gt;&lt;/u&gt;&lt;sub&gt;&lt;/sub&gt;&lt;sup&gt;&lt;/sup&gt;&lt;strike&gt;&lt;/strike&gt;&lt;br /&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/05/chmod-in-unix.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy26GSIYMXZSfMD59_fXyPsfKMTUkkIsycoPKPuRO92Vf7zuUHr_tXFvH18YDhV4qUECdLuHpJtxz4gX_n_bTvlKz3PyhvEDsdJCx5j_z04dY2akGH3w1ZcPmVqgFDr16lBuU0nOw8lUA/s72-c/linuxlearners.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-8186760627307799497</guid><pubDate>Sat, 31 Mar 2018 07:32:00 +0000</pubDate><atom:updated>2018-03-31T13:02:53.645+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">datastructure</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">linked list</category><title>C program for Doubly Linked List</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In computer science, a &lt;b&gt;doubly linked list&lt;/b&gt; is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains two fields, called &lt;i&gt;links&lt;/i&gt;, that are references to the previous and to the next node in the sequence of nodes. The beginning and ending nodes&#39; &lt;b&gt;previous&lt;/b&gt; and &lt;b&gt;next&lt;/b&gt; links, respectively, point to some kind of terminator, typically a sentinel node or null,
 to facilitate traversal of the list. If there is only one sentinel 
node, then the list is circularly linked via the sentinel node. It can 
be conceptualized as two &lt;a href=&quot;https://dotcprograms.blogspot.in/2018/03/c-program-for-singly-linked-list.html&quot; target=&quot;_blank&quot; title=&quot;Linked list&quot;&gt;singly linked lists&lt;/a&gt; formed from the same data items, but in opposite sequential orders.&lt;br /&gt;
The two node links allow traversal of the list in either direction. 
While adding or removing a node in a doubly linked list requires 
changing more links than the same operations on a singly linked list, 
the operations are simpler and potentially more efficient (for nodes 
other than first nodes) because there is no need to keep track of the 
previous node during traversal or no need to traverse the list to find 
the previous node, so that its link can be modified.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi573au7LYzF-a-cNJoQcvCIuD9Z0-RMCBgArqRSYWyXLFSBb5C-SqO8qYY8uujHxQrLTBf2JGUHmKtYVFTBVCnI4IDsaBVM80Y-CSfidY7h51jIkc4zQJbAM1uCLEcJBFdNs6NOqWrRr0/s1600/DLL1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;186&quot; data-original-width=&quot;907&quot; height=&quot;130&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi573au7LYzF-a-cNJoQcvCIuD9Z0-RMCBgArqRSYWyXLFSBb5C-SqO8qYY8uujHxQrLTBf2JGUHmKtYVFTBVCnI4IDsaBVM80Y-CSfidY7h51jIkc4zQJbAM1uCLEcJBFdNs6NOqWrRr0/s640/DLL1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
****************Implementation******************************* &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdlib.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;prev&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; data&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; create&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; display&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; insert_at_any_position&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; print_reverse&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; reverse_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; choice&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;do&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;1.Create Double List&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;2.Display lists&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;3.Insert at any position&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;4.Print reverse&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;5.Reverse List&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;6.Exit&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;choice&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            create&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            display&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            insert_at_any_position&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            print_reverse&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            reverse_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;wrong choice.......&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;


    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;create&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;new_node&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    new_node&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #603000;&quot;&gt;malloc&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sizeof&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter data in form of integer&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;new_node&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    new_node&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;new_node&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        head&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;new_node&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        new_node&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
display&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; choice2&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;1.From first&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;2.From last&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;choice2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice2&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; ==&amp;gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice2&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; ==&amp;gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;


&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; insert_at_any_position&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;ptr&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    ptr&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #603000;&quot;&gt;malloc&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sizeof&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; pos&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Insert position number&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;pos&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;pos&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    ptr&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;ptr&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    ptr&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;ptr&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter data&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;ptr&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;print_reverse&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; ==&amp;gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;reverse_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;p&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        p&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;prev&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/03/c-program-for-doubly-linked-list.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi573au7LYzF-a-cNJoQcvCIuD9Z0-RMCBgArqRSYWyXLFSBb5C-SqO8qYY8uujHxQrLTBf2JGUHmKtYVFTBVCnI4IDsaBVM80Y-CSfidY7h51jIkc4zQJbAM1uCLEcJBFdNs6NOqWrRr0/s72-c/DLL1.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-2389104579293681537</guid><pubDate>Sat, 31 Mar 2018 07:27:00 +0000</pubDate><atom:updated>2018-03-31T12:57:04.250+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">datastructure</category><category domain="http://www.blogger.com/atom/ns#">linked list</category><title>C program for Singly Linked list</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Singly Linked Lists are a type of data structure. In a singly linked 
list, each node in the list stores the contents and a pointer or 
reference to the next node in the list. It does not store any pointer or
 reference to the previous node. To store a single linked list, only the
 reference or pointer to the first node in that list must be stored. The
 last node in a single linked list points to nothing.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6inME4k-P1ERF7KvFSPogwU1yZ1DoCT9VPeX1F1ReDIOBdIQUAFNfgoN76SrvaukWX6vRSHHRifQUgXVedVRw1Xm9bY1RlOtgP3o0mgvSqAXIjUpLP3E__dG_94hm6byVcDD6TAE7zoc/s1600/single-list.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;222&quot; data-original-width=&quot;527&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6inME4k-P1ERF7KvFSPogwU1yZ1DoCT9VPeX1F1ReDIOBdIQUAFNfgoN76SrvaukWX6vRSHHRifQUgXVedVRw1Xm9bY1RlOtgP3o0mgvSqAXIjUpLP3E__dG_94hm6byVcDD6TAE7zoc/s320/single-list.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255); overflow:auto;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdlib.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//............................................Function Creation...........................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; createlinkedlist&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; display&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; insert_at_first&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; delete_from_first&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; delete_from_end&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; insert_at_selected_position&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; delete_entire_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; reverse_nodes&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//.........................................structure node...............................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; roll&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;char&lt;/span&gt; name&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//......................................................MAIN..............................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; ch&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;do&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;

        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;1.Create Linked list&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;2.Display List&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;

            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;3.Delete From First&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;4.Delete From end&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;5.Insert at first&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;6.Insert at selected position&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;7.Delete entire List&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;8.Reverse List&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;9.Exit&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;


        &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;ch&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ch&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            createlinkedlist&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            display&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            insert_at_first&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            delete_from_first&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            delete_from_end&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            insert_at_selected_position&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            delete_entire_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            reverse_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;color: #e34adc;&quot;&gt;:&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Wrong choice Try again......&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ch&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//............................................Create linked list.................................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; createlinkedlist&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;newnode&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    newnode&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #603000;&quot;&gt;malloc&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sizeof&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Roll :  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;newnode&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;roll&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Name :  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;newnode&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;name&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    newnode&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;newnode&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;newnode&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;// ......................................................DISPLAY............................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; display&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Roll&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;roll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;name&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;


    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;List is empty Boss... &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//............................................Insert At FIrst.................................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; insert_at_first&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;newnode&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    newnode&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; student &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #603000;&quot;&gt;malloc&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sizeof&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Roll :  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;newnode&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;roll&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Name :  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;newnode&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;name&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;newnode&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    newnode&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//..............................................Delete from first.....................................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; delete_from_first&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;List is empty Boss... &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;free&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;First list deleted from node...&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//..............................................Delete from end................................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; delete_from_end&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;newtemp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        newtemp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            newtemp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;free&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Last node is deleted....&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//..................................................Insert at selected position....................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; insert_at_selected_position&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;new_temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp_copy&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; position&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;i&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the roll before you want to insert&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;position&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;position&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    temp_copy&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    new_temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #603000;&quot;&gt;malloc&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sizeof&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;new_temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Roll :  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;new_temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;roll&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Name :  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;new_temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;name&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    new_temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp_copy&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//..................................................free entire list........................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; delete_entire_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;had&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;free&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        had&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;free&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;had&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;//.......................................Reverse List....................................//&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; reverse_list&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;head&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;sorry BOSS &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; reverse not possible...&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; node &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;p1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;p2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;p3&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    p1&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;head&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    p2&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p1&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    p3&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p1&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    p1&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;p3&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #7d0045;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;

        p2&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p1&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        p1&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p2&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        p2&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p3&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        p3&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p3&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    p2&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;next&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p1&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    head&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;p2&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/03/c-program-for-singly-linked-list.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6inME4k-P1ERF7KvFSPogwU1yZ1DoCT9VPeX1F1ReDIOBdIQUAFNfgoN76SrvaukWX6vRSHHRifQUgXVedVRw1Xm9bY1RlOtgP3o0mgvSqAXIjUpLP3E__dG_94hm6byVcDD6TAE7zoc/s72-c/single-list.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-69146069736529780</guid><pubDate>Thu, 29 Mar 2018 14:38:00 +0000</pubDate><atom:updated>2018-03-29T20:11:30.867+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">bisection method</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">numerical methods</category><title>C program for Bisection Method</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The &lt;b&gt;bisection method&lt;/b&gt; in mathematics is a root-finding method that repeatedly bisects an interval and then selects a subinterval in which a root
 must lie for further processing. It is a very simple and robust method,
 but it is also relatively slow. Because of this, it is often used to 
obtain a rough approximation to a solution which is then used as a 
starting point for more rapidly converging methods. The method is also called the &lt;b&gt;interval halving&lt;/b&gt; method, the &lt;b&gt;binary search method&lt;/b&gt;, or the &lt;b&gt;dichotomy method&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsMA7YvBUBqfD2qEtxgbMNNHyqiKHE3ITDMxK2dy4xdmOhc-JQtqgNlRxdY_MnYwVmLtF9OBvRtrcbRGjIE00xP88TayFVyIEN2A_5pCXzDDTMKJbjwK__7dmq1pkkZfATNIu-m48fdB0/s1600/800px-Bisection_method.svg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;933&quot; data-original-width=&quot;800&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsMA7YvBUBqfD2qEtxgbMNNHyqiKHE3ITDMxK2dy4xdmOhc-JQtqgNlRxdY_MnYwVmLtF9OBvRtrcbRGjIE00xP88TayFVyIEN2A_5pCXzDDTMKJbjwK__7dmq1pkkZfATNIu-m48fdB0/s320/800px-Bisection_method.svg.png&quot; width=&quot;274&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
******************C program*********************&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdlib.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;math.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: dimgrey;&quot;&gt;// the function&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; xa      &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; xb      &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; xm&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; epsilon &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;0.0001&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; max_iteration &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; counter&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Finding the Roots with the Bisection Method&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    printf(&quot;Enter Xa&quot;);
    scanf(&quot;%lf&quot;,&amp;amp;xa);
    printf(&quot;Enter Xb&quot;);
    scanf(&quot;%lf&quot;,&amp;amp;xb);
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Initial x- values:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;f(&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%.2lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;) = &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xa&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xa&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;f(&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%.2lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;) = &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xb&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;epsilon = &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; epsilon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;// Make sure f(xa) and f(xb) have opposite signs&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xa&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xb&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Error: f(xa) and f(xb) don&#39;t have opposite signs!&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;PAUSE&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    
    xm &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xa&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;xb&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: dimgrey;&quot;&gt;// initial value of xm&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;     xa         xb        f(xa)      f(xb)       xm        f(xm)&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;    

    &lt;span style=&quot;color: dimgrey;&quot;&gt;// Loop of the bisection method&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;counter&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;max_iteration &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #603000;&quot;&gt;fabs&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xm&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;epsilon&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
          xm &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xa&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;xb&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
          &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%10lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%10lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%10lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%10lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%10lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%10lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xa&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xa&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xb&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xm&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
          
          &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xa&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xm&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
              xb &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; xm&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
          &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; xa &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; xm&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
          
          counter&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: dimgrey;&quot;&gt;// increment the counter&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Number of iterations done: &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%.0lf&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;, max_iterations=&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%.0lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; counter&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; max_iteration&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;The root is: &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xm&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;The root we found makes the function equal to: f(xm)=&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%lf&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;xm&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;      
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;PAUSE&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;    
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;//******************&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; f&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; x&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
       &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;double&lt;/span&gt; val&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
       
       val &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #603000;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;x&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #603000;&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;x&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
       &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; val&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
***********************End**********************&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/03/c-program-for-bisection-method.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsMA7YvBUBqfD2qEtxgbMNNHyqiKHE3ITDMxK2dy4xdmOhc-JQtqgNlRxdY_MnYwVmLtF9OBvRtrcbRGjIE00xP88TayFVyIEN2A_5pCXzDDTMKJbjwK__7dmq1pkkZfATNIu-m48fdB0/s72-c/800px-Bisection_method.svg.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-5812487201392985503</guid><pubDate>Sun, 11 Mar 2018 05:01:00 +0000</pubDate><atom:updated>2018-03-16T17:32:09.483+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">arudino</category><category domain="http://www.blogger.com/atom/ns#">cprogram</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">robotics</category><title>Arduino - Robot using C program</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3&gt;
Connecting the robot to your computer&lt;/h3&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;1962352932&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
Each board on the robot has a microcontroller, which is programmed 
independently of the other. It is recommended that you should only 
program the control board (the top board) until you are familiar with 
the robot&#39;s functionality. The motor board (the bottom board) has a 
stock firmware that fulfills most general purpose applications.&lt;br /&gt;
&lt;br /&gt;
Connect the control board to your computer with a USB cable. 
&lt;br /&gt;
After you have connected the board, the green LED labelled as PWR on the Control Board will be on. &lt;span class=&quot;wikiword&quot;&gt;LED1&lt;/span&gt; beneath it will flash a few times. On the Motor Board, the red &lt;span class=&quot;wikiword&quot;&gt;LEDs&lt;/span&gt; labelled as &lt;span class=&quot;wikiword&quot;&gt;LED1&lt;/span&gt; to &lt;span class=&quot;wikiword&quot;&gt;LED5&lt;/span&gt; (opposite side to the power switch) should be on as well.&lt;br /&gt;
&lt;br /&gt;
If the &lt;span class=&quot;wikiword&quot;&gt;LEDs&lt;/span&gt; on either board do not turn
 on, check if the flat 10-pin communication cable next to the power 
switch is connected to both boards&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Installing the drivers&lt;/h3&gt;
&lt;h4&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;toc5&quot; name=&quot;toc5&quot;&gt;&lt;/a&gt;OSX&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;The first time you plug a robot into a computer running OSX, the
 &quot;Keyboard Setup Assistant&quot; will launch. There&#39;s nothing to configure 
with the robot, so you can close this dialogue by clicking the red 
button in the top left of the window. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Windows&lt;/h4&gt;
The following instructions are for Windows 7. They are valid also for Windows XP, with small differences in the dialog windows.
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Plug in your board and wait for Windows to begin its driver 
installation process. If the installer does not launch automatically, 
navigate to the Windows Device Manager (Start&amp;gt;Control 
Panel&amp;gt;Hardware) and find the Arduino Robot listing. Right click and 
choose &lt;b&gt;Update driver&lt;/b&gt;.&lt;/li&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKpzeSg9BX61OM6AQzTPdsEVjBjGmT5uzjcwK1igNjXaA4q8SxNSFSrEE7LuLq6Q3RBEzjUDXJ-qfwJLoQvLfr6sukFbLrFJ0LMHK38PqImjjsz7Gl1QUnAUVSh9K82ieT2IAJi7niHRc/s1600/ArduinoRobotWindowsDrivers0.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;579&quot; data-original-width=&quot;795&quot; height=&quot;465&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKpzeSg9BX61OM6AQzTPdsEVjBjGmT5uzjcwK1igNjXaA4q8SxNSFSrEE7LuLq6Q3RBEzjUDXJ-qfwJLoQvLfr6sukFbLrFJ0LMHK38PqImjjsz7Gl1QUnAUVSh9K82ieT2IAJi7niHRc/s640/ArduinoRobotWindowsDrivers0.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;li&gt;At the next screen, choose &quot;Browse my computer for driver software&quot;, and click Next. &lt;/li&gt;
&lt;li&gt;Click the Browse... button. Another dialog appears: navigate to the folder with the Arduino software that you just downloaded. Select the drivers folder an click OK, then click Next. &lt;/li&gt;
&lt;li&gt;You will receive a notification that the board has not passed Windows Logo testing. Click on the button Continue Anyway. &lt;/li&gt;
&lt;li&gt;After a few moments, a window will tell you the wizard has finished installing software for Arduino Robot. Press the Close button. &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Uploading a test sketch&lt;/h3&gt;
To program the robot, connect the &lt;b&gt;Control Board&lt;/b&gt; to 
your computer via USB. Open the Arduino IDE, and load the sketch located
 in  File &amp;gt; Examples &amp;gt; Robot_Control &amp;gt; learn &amp;gt; &lt;span class=&quot;wikiword&quot;&gt;MotorTest&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
You need to tell the IDE which Arduino board you are targeting with your software, so open the &lt;b&gt;Tools &amp;gt; Board&lt;/b&gt; menu and choose &lt;b&gt;Arduino Robot Control&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
The Arduino IDE must know which of your USB ports the robot is connected to. The &lt;b&gt;Tools &amp;gt; Serial&lt;/b&gt; menu lists the available ports.
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;if only one item is shown, click on that one.
&lt;/li&gt;
&lt;li&gt;if two or more are shown, you can disconnect the Control Board 
and re-open the menu; the entry that disappears should be the robot. 
Reconnect the board and select that serial port.
&lt;/li&gt;
&lt;/ul&gt;
Click the &quot;Upload&quot; button in the top left of the IDE 
window. Wait a few seconds - you should see the RX and TX leds on the 
board flashing. If the upload is successful, the message &quot;Done 
uploading.&quot; will appear in the status bar of the software. Once this 
appears, you can disconnect the robot from the USB cable
&lt;br /&gt;
With batteries in the robot, turn on the power switch and put it on 
the ground. The robot should show you a few basic moves. 
Congratulations! You&#39;ve gotten the robot up and running.&lt;br /&gt;
&lt;br /&gt;
If the robot is not moving, turn the power switch off. Connect the &lt;b&gt;motor board&lt;/b&gt;
 to the computer with a USB cable. Load the File &amp;gt; Examples &amp;gt; 
Robot_Motor &amp;gt; Robot_Motor_Core sketch in the IDE, and select &lt;b&gt;Arduino Robot Motor&lt;/b&gt; from the &lt;b&gt;Boards&lt;/b&gt; menu. Upload this sketch, disconnect from the computer and try turning it on again&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note: If no Serial port shows up after you plug in the robot,
 and restarting the IDE/unplug-replug the robot does not help, follow 
the steps below:&lt;/b&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Open a very simple sketch, like Blink or &lt;span class=&quot;wikiword&quot;&gt;BareMinimum&lt;/span&gt; 
&lt;/li&gt;
&lt;li&gt;Press the upload button
&lt;/li&gt;
&lt;li&gt;When the status bar shows &quot;Uploading...&quot;, double press the reset button on the Control Board
&lt;/li&gt;
&lt;li&gt;The Serial port should appear as normally.&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Moving the Robot&lt;/h3&gt;
This sketch moves the robot back and forth repeatedly.
&lt;br /&gt;

Whenever you&#39;re writing code for the robot, make sure to include &amp;lt;&lt;span class=&quot;wikiword&quot;&gt;ArduinoRobot&lt;/span&gt;.h&amp;gt; at the beginning of the sketch. This imports the necessary libraries to control the robot.
&lt;br /&gt;

There&#39;s no need to initialize the Robot object.
&lt;br /&gt;

To get the wheels to move, call &lt;a class=&quot;wikilink&quot; href=&quot;https://www.arduino.cc/en/Reference/RobotMotorsWrite&quot;&gt;Robot.motorsWrite()&lt;/a&gt;.
 motorsWrite() requires 2 arguments, the speed of the left motor, and 
the speed of the right motor. These values range from -255 to 255, where
 -255 is full reverse, and 255 is full speed forward. If you pass a 
value of 0, the motor will stop spinning the wheel. 
&lt;br /&gt;

Once you&#39;ve uploaded the sketch, unplug the USB cable for the robot. 
Whenever the USB is connected, the robot&#39;s motors are disengaged. Turn 
on the power and watch it move around!&lt;br /&gt;
&lt;br /&gt;



&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock1&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;#&lt;span style=&quot;color: #ff5600;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #00a33f;&quot;&gt;&amp;lt;ArduinoRobot.h&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #919191;&quot;&gt;// import the robot library&lt;/span&gt;

&lt;span style=&quot;color: #ff5600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #21439c;&quot;&gt;setup&lt;/span&gt;(){
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;begin&lt;/span&gt;(); // initialize the library
}

&lt;span style=&quot;color: #ff5600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #21439c;&quot;&gt;loop&lt;/span&gt;(){
  // move forward for one second
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;motorsWrite&lt;/span&gt;(255,255);
  delay(1000);

  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;motorsWrite&lt;/span&gt;(0,0); // stop moving
  delay(1000);

  // move backwards for one second
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;motorsWrite&lt;/span&gt;(-255,-255);
  delay(1000);

  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;motorsWrite&lt;/span&gt;(0,0); // stop moving
  delay(1000);
}&lt;/pre&gt;
&lt;span class=&quot;br0&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;toc11&quot; name=&quot;toc11&quot;&gt;&lt;/a&gt;Read the buttons&lt;/h4&gt;
You&#39;ll be writing a sketch that prints the button presses to the screen.
&lt;br /&gt;

First, you need to include the Robot library.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock2&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;#&lt;span style=&quot;color: #ff5600;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #00a33f;&quot;&gt;&amp;lt;ArduinoRobot.h&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;span class=&quot;co2&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
In &lt;code&gt;setup()&lt;/code&gt;, start the robot and the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock3&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;&lt;span style=&quot;color: #ff5600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #21439c;&quot;&gt;setup&lt;/span&gt;(){
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;begin&lt;/span&gt;();
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;beginTFT&lt;/span&gt;();
}
&lt;/pre&gt;
&lt;span class=&quot;br0&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock3&quot;&gt;
&amp;nbsp;&lt;/div&gt;
In &lt;code&gt;loop()&lt;/code&gt;, every 100ms, read the state of the buttons. If one is being pressed, write the name to the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock4&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;&lt;span style=&quot;color: #ff5600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #21439c;&quot;&gt;loop&lt;/span&gt;(){
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;debugPrint&lt;/span&gt;(Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;keyboardRead&lt;/span&gt;(), 10, 10);
  delay(100);
}&lt;/pre&gt;
&lt;span class=&quot;br0&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock4&quot;&gt;
&amp;nbsp;&lt;/div&gt;
In the &lt;em&gt;explore&lt;/em&gt; folder of the robot examples, there is a sketch called &lt;em&gt;Logo&lt;/em&gt;, which incorporates this example with the robot movement from above. 
&lt;br /&gt;

&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;toc12&quot; name=&quot;toc12&quot;&gt;&lt;/a&gt;Change the motor speed with the potentiometer&lt;/h3&gt;
This lets you control the speed at which the robot moves in a 
straight line. By turning the knob and mapping the values to -255 to 
255, you will set the speed and direction (forward or backwards) of the 
robot.
&lt;br /&gt;

First, you need to include the Robot library.

&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock5&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;ArduinoRobot.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sourceblocklink&quot;&gt;
&lt;a href=&quot;https://www.arduino.cc/en/Guide/Robot?action=sourceblock&amp;amp;num=5&quot; type=&quot;text/plain&quot;&gt;[Get Code]&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
In &lt;code&gt;setup()&lt;/code&gt;, you must call &lt;code&gt;Robot.begin()&lt;/code&gt; to initialize the robot&#39;s functions. Also call &lt;code&gt;Robot.beginTFT()&lt;/code&gt; to initialize the screen.

&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock6&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;span class=&quot;kw1&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Robot.&lt;span class=&quot;kw1&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; Robot.&lt;span class=&quot;me1&quot;&gt;beginTFT&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sourceblocklink&quot;&gt;
&lt;a href=&quot;https://www.arduino.cc/en/Guide/Robot?action=sourceblock&amp;amp;num=6&quot; type=&quot;text/plain&quot;&gt;[Get Code]&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
In &lt;code&gt;loop()&lt;/code&gt;, read the value of the potentiometer with &lt;code&gt;Robot.knobRead()&lt;/code&gt;.
 Map its value (a number between 0 and 1023) to -255 to 255. Print this 
value to the screen, and use it to change the speed of the motors.
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;1962352932&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock7&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;span class=&quot;kw1&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;kw1&quot;&gt;int&lt;/span&gt; val&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;Robot.&lt;span class=&quot;me1&quot;&gt;knobRead&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1023&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; Robot.&lt;span class=&quot;me1&quot;&gt;debugPrint&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;val&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; Robot.&lt;span class=&quot;me1&quot;&gt;motorsWrite&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;val&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;val&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span class=&quot;kw1&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sourceblocklink&quot;&gt;
&lt;a href=&quot;https://www.arduino.cc/en/Guide/Robot?action=sourceblock&amp;amp;num=7&quot; type=&quot;text/plain&quot;&gt;[Get Code]&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
The robot&#39;s motor is disengaged when plugged in via USB. After 
programming the robot, unplug the USB cable and add batteries. Turn on 
the power switch and watch the robot move. Catch the robot, and change 
the knob to change its speed.
&lt;br /&gt;

&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;toc13&quot; name=&quot;toc13&quot;&gt;&lt;/a&gt;Making some noise&lt;/h3&gt;
The robot has two different means of producing sounds. There&#39;s simple
 beeping, but the robot can also create more complex sounds by reading 
sequenced music off the SD card. In this example you&#39;ll start with the 
beeping. To learn about the more complex playback, see the &lt;em&gt;Melody&lt;/em&gt; example in the &lt;em&gt;learn&lt;/em&gt; folder.&lt;br /&gt;
&lt;br /&gt;

&lt;pre&gt; First, you need to include the Robot library.&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock8&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;#&lt;span style=&quot;color: #ff5600;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #00a33f;&quot;&gt;&amp;lt;ArduinoRobot.h&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;span class=&quot;co2&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
In &lt;code&gt;setup()&lt;/code&gt;, you must call &lt;code&gt;Robot.begin()&lt;/code&gt; to initialize the robot&#39;s functions. Also call &lt;code&gt;Robot.beginSpeaker()&lt;/code&gt; to initialize the speaker.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock9&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;&lt;span style=&quot;color: #ff5600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #21439c;&quot;&gt;setup&lt;/span&gt;(){
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;begin&lt;/span&gt;();
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;beginSpeaker&lt;/span&gt;();
}&lt;/pre&gt;
&lt;br /&gt;&lt;span class=&quot;kw1&quot;&gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
In &lt;code&gt;loop()&lt;/code&gt;, you can call &lt;code&gt;Robot.beep()&lt;/code&gt; to create a beep. There are three different kinds of beeping; a simple beep, a double beep, and a long beep.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock10&quot;&gt;
  &lt;div class=&quot;sourceblocktext&quot;&gt;
&lt;div class=&quot;arduino&quot;&gt;
&lt;pre style=&quot;background: #fff; color: black;&quot;&gt;&lt;span style=&quot;color: #ff5600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #21439c;&quot;&gt;loop&lt;/span&gt;() {
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;beep&lt;/span&gt;(BEEP_SIMPLE);
  delay(1000);
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;beep&lt;/span&gt;(BEEP_DOUBLE);
  delay(1000);
  Robot.&lt;span style=&quot;color: #a535ae;&quot;&gt;beep&lt;/span&gt;(BEEP_LONG);
  delay(1000);
}&lt;/pre&gt;
&lt;span class=&quot;br0&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;toc14&quot; name=&quot;toc14&quot;&gt;&lt;/a&gt;Next steps&lt;/h3&gt;
There are many things you can do with the robot. The few examples on 
this page don&#39;t do it justice. To see some more complex examples that of
 what the robot can do, look at the sketches found in the &lt;em&gt;Explore&lt;/em&gt; folder of the robot examples. These are more complete examples that show you some different applications for the robot.&lt;br /&gt;
&lt;br /&gt;

You&#39;ll need to calibrate the compass module of the robot so it 
rotates smoothly. If you&#39;re using an old model, which has Honeywell HMC 
6352, you can refer to this tutorial: &lt;a class=&quot;wikilink&quot; href=&quot;https://www.arduino.cc/en/Tutorial/RobotCompassCalibration&quot;&gt;Calibrate Compass&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;
&lt;br /&gt;

To learn about more of the functionality of the specific inputs and outputs of the robot, look at the &lt;em&gt;learn&lt;/em&gt; folder in the robot examples. 
&lt;br /&gt;

Be sure to check out the &lt;a class=&quot;wikilink&quot; href=&quot;https://www.arduino.cc/en/Reference/RobotLibrary&quot;&gt;Robot&#39;s library&lt;/a&gt; page and the &lt;a class=&quot;wikilink&quot; href=&quot;https://www.arduino.cc/en/Main/Robot&quot;&gt;hardware page&lt;/a&gt; for more information about the technical aspects of the Robot.
&lt;br /&gt;&lt;br /&gt;The text of the Arduino getting started guide is licensed under a
&lt;a class=&quot;urllink&quot; href=&quot;http://creativecommons.org/licenses/by-sa/3.0/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Creative Commons Attribution-ShareAlike 3.0 License&lt;/a&gt;.  Code samples in the guide are released into the public domain.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;source: www.arudino.cc&lt;/span&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/03/arduino-robot-using-c-program.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKpzeSg9BX61OM6AQzTPdsEVjBjGmT5uzjcwK1igNjXaA4q8SxNSFSrEE7LuLq6Q3RBEzjUDXJ-qfwJLoQvLfr6sukFbLrFJ0LMHK38PqImjjsz7Gl1QUnAUVSh9K82ieT2IAJi7niHRc/s72-c/ArduinoRobotWindowsDrivers0.jpg" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-2041037408148834299</guid><pubDate>Mon, 05 Mar 2018 04:47:00 +0000</pubDate><atom:updated>2018-03-05T10:17:19.357+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">filesinc</category><title>File reading &amp; writing in C with different modes</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3qhIlXIfYMBVtgdNbDhxTFdDJ6N2ZYZZy2fLgYW4ZEM4GHCrGp1p8w3YW2q3M4-Szt__DuekGxDdrZFNXTA_LZdfDIOn0wGELCcM3x0Q38BWmI5cnb3NyNII1gxl4Zs0HOmGzX9xjR7A/s1600/File+Handling+in+C.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;559&quot; data-original-width=&quot;1600&quot; height=&quot;111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3qhIlXIfYMBVtgdNbDhxTFdDJ6N2ZYZZy2fLgYW4ZEM4GHCrGp1p8w3YW2q3M4-Szt__DuekGxDdrZFNXTA_LZdfDIOn0wGELCcM3x0Q38BWmI5cnb3NyNII1gxl4Zs0HOmGzX9xjR7A/s320/File+Handling+in+C.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 id=&quot;1&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
1. Opening a file&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;function is used for opening a file.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Syntax:&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;FILE pointer_name &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;file_name&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;Mode&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;pointer_name&lt;/code&gt;&amp;nbsp;can be anything of your choice.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;file_name&lt;/code&gt;&amp;nbsp;is the name of the file, which you want to open. Specify the full path here like “C:\\myfiles\\newfile.txt”.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
While opening a file, you need to specify the mode. The mode that we use to read a file is “r” which is “read only mode”.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;for example:&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;FILE  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fp&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
fp &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;C:\\myfiles\\newfile.txt&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;r&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
The address of the first character is stored in&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;pointer fp&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;How to check whether the file has opened successfully?&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;If file does not open successfully then the pointer will be assigned a NULL value, so you can write the logic like this:&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;This code will check whether the file has opened successfully or not. If the file does not open, this will display an error message to the user.&lt;/div&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
FILE fpr&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
fpr &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;C:\\myfiles\\newfile.txt&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;r&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpr &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; NULL&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    puts&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;Error while opening file&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;h3 style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 22px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
&lt;br /&gt;&lt;/h3&gt;
&lt;h3 style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 22px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
Various File Opening Modes:&lt;/h3&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
The file is opened using&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;function, while opening you can use any of the following mode as per the requirement.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Mode “r”:&lt;/span&gt;&amp;nbsp;It is a read only mode, which means if the file is opened in r mode, it won’t allow you to write and modify content of it. When&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;opens a file successfully then it returns the address of first character of the file, otherwise it returns NULL.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Mode “w”:&lt;/span&gt;&amp;nbsp;It is a write only mode. The&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;function creates a new file when the specified file doesn’t exist and if it fails to open file then it returns NULL.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Mode “a”:&lt;/span&gt;&amp;nbsp;Using this mode Content can be appended at the end of an existing file. Like Mode “w”,&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; box-sizing: border-box; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;creates a new file if it file doesn’t exist. On unsuccessful open it returns NULL.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;File Pointer points to: last character of the file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Mode “r+”:&lt;/span&gt;&amp;nbsp;This mode is same as mode “r”; however you can perform various operations on the file opened in this mode. You are allowed to read, write and modify the content of file opened in “r+” mode.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;File Pointer points to: First character of the file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Mode “w+”:&lt;/span&gt;&amp;nbsp;Same as mode “w” apart from operations, which can be performed; the file can be read, write and modified in this mode.&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Mode “a+”:&lt;/span&gt;&amp;nbsp;Same as mode “a”; you can read and append the data in the file, however content modification is not allowed in this mode.&lt;/div&gt;
&lt;h2 id=&quot;2&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
2. Reading a File&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
To read the file, we must open it first using any of the mode, for example if you only want to read the file then open it in “r” mode. Based on the mode selected during file opening, we are allowed to perform certain operations on the file.&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 22px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
C Program to read a file&lt;/h3&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;fgetc( ):&lt;/span&gt;&amp;nbsp;This function reads the character from current pointer’s position and upon successful read moves the pointer to next character in the file. Once the pointers reaches to the end of the file, this function returns&amp;nbsp;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;EOF (End of File)&lt;/span&gt;. We have used&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;&amp;nbsp;EOF&lt;/span&gt;in our program to determine the end of the file.&lt;/div&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Pointer to the file */&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     FILE &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fp1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Character variable to read the content of file */&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Opening a file in r mode*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     fp1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;C:\\myfiles\\newfile.txt&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;r&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Infinite loop –I have used break to come out of the loop*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
        c &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fgetc&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fp1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
            printf&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;%c&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     fclose&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fp1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;h2 id=&quot;3&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 id=&quot;3&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
3. Writing to a file&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
To write the file, we must open the file in a mode that supports writing. For example, if you open a file in “r” mode, you won’t be able to write the file as “r” is read only mode that only allows reading.&lt;/div&gt;
&lt;h2 style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
Example: C Program to write the file&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-7979004486439013&quot;
     data-ad-slot=&quot;1962352932&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
This program asks the user to enter a character and writes that character at the end of the file. If the file doesn’t exist then this program will create a file with the specified name and writes the input character into the file.&lt;/div&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; ch&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   FILE &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   fpw &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;C:\\newfile.txt&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; NULL&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
      printf&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;   
      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;             
   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

   printf&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;Enter any character: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   scanf&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;%c&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* You can also use fputc(ch, fpw);*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   fprintf&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;%c&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
   fclose&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;h2 id=&quot;4&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 id=&quot;4&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
4. Closing a file&lt;/h2&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fclose&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fp&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #222426; font-family: &amp;quot;PT Sans&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 17px; margin-bottom: 26px; padding: 0px;&quot;&gt;
The&amp;nbsp;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;fclose( )&lt;/span&gt;&amp;nbsp;function is used for closing an opened file. As an argument you must provide a pointer to the file that you want to close.&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 22px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
An example to show Open, read, write and close operation in C&lt;/h3&gt;
&lt;pre class=&quot;prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; box-sizing: border-box; clear: both; color: #222426; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; overflow: auto; padding: 2px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; ch&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Pointer for both the file*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    FILE &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpr&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Opening file FILE1.C in “r” mode for reading */&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    fpr &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;C:\\file1.txt&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;r&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Ensure FILE1.C opened successfully*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpr &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; NULL&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
         puts&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;Input file cannot be opened&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Opening file FILE2.C in “w” mode for writing*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fopen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;C:\\file2.txt&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Ensure FILE2.C opened successfully*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-7979004486439013&quot;
     data-ad-slot=&quot;1962352932&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; NULL&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
       puts&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;&quot;Output file cannot be opened&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/*Read &amp;amp; Write Logic*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
        ch &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fgetc&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpr&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
            fputc&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-7979004486439013&quot;
     data-ad-slot=&quot;1962352932&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: grey;&quot;&gt;/* Closing both the files */&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    fclose&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpr&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
    fclose&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;fpw&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: darkblue;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: maroon;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;h2 id=&quot;5&quot; style=&quot;background-color: white; box-sizing: border-box; color: #444542; font-family: &amp;quot;PT Sans&amp;quot;, &amp;quot;Trebuchet MS&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 26px; line-height: 1.2; margin: 0px 0px 16px;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/03/file-reading-writing-in-c-with.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3qhIlXIfYMBVtgdNbDhxTFdDJ6N2ZYZZy2fLgYW4ZEM4GHCrGp1p8w3YW2q3M4-Szt__DuekGxDdrZFNXTA_LZdfDIOn0wGELCcM3x0Q38BWmI5cnb3NyNII1gxl4Zs0HOmGzX9xjR7A/s72-c/File+Handling+in+C.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-3107509022615190927</guid><pubDate>Fri, 02 Mar 2018 12:16:00 +0000</pubDate><atom:updated>2018-03-02T17:49:10.732+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c games</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">tictactoe</category><title>Tic Tac Toe game using C program</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Tic-tac-toe is a paper-and-pencil game for two players, X and O, 
who take turns marking the spaces in a 3×3 grid. The player who succeeds
 in placing three of their marks in a horizontal, vertical, or diagonal 
row wins the game.&lt;br /&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-7979004486439013&quot;
     data-ad-slot=&quot;1962352932&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Jeu5hHuZknTiimF8NaXB99-gC0sHquxEvnXcl7-vhjwlr-GBxRhE45VL-xf6O1dyoLjgYxEIqjLxlmuesGUaWbKK0DRn_ayXoEHAM6aVHL1xKQ6w1zfZE0CQnChonOERTyjCRP6TShuM/s1600/2000px-Tic_tac_toe.svg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1423&quot; data-original-width=&quot;1600&quot; height=&quot;284&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Jeu5hHuZknTiimF8NaXB99-gC0sHquxEvnXcl7-vhjwlr-GBxRhE45VL-xf6O1dyoLjgYxEIqjLxlmuesGUaWbKK0DRn_ayXoEHAM6aVHL1xKQ6w1zfZE0CQnChonOERTyjCRP6TShuM/s320/2000px-Tic_tac_toe.svg.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;wikipedia&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
************Source Code***********&lt;/h3&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;char&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;o&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;1&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;2&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;3&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;4&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;5&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;6&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;7&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;8&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;9&#39;&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; checkwin&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; board&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; player &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; choice&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;char&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;do&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        board&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        player &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;player &lt;span style=&quot;color: #808030;&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;?&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Player &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;, enter a number:  &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; player&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;choice&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        mark &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;player &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;?&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;X&#39;&lt;/span&gt; &lt;span style=&quot;color: purple;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;O&#39;&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;1&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;2&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;3&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;4&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;5&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;6&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;7&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;8&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;choice &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;9&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; mark&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Invalid move &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

            player&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        i &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; checkwin&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        player&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;  &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    board&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;==&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\a&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Player &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; win &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;player&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;==&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\a&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Game draw&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/*********************************************&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;FUNCTION TO RETURN GAME STATUS&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;1 FOR GAME IS OVER WITH RESULT&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;-1 FOR GAME IS IN PROGRESS&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;O GAME IS OVER AND NO RESULT&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;**********************************************/&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; checkwin&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;1&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;2&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;3&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;
        square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;4&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;5&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;6&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; 
        &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;7&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;8&#39;&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;9&#39;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;

        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt;  &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;


&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/*******************************************************************&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;FUNCTION TO DRAW BOARD OF TIC TAC TOE WITH PLAYERS MARK&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;********************************************************************/&lt;/span&gt;


&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; board&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;system&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;cls&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Tic Tac Toe&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Player 1 (X)  -  Player 2 (O)&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;


    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;     |     |     &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  |  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  |  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;_____|_____|_____&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;     |     |     &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  |  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  |  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;_____|_____|_____&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;     |     |     &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  |  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;  |  &lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; square&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;     |     |     &lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: #3f5fbf;&quot;&gt;/*******************************************************************&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;END OF PROJECT&lt;/span&gt;
&lt;span style=&quot;color: #3f5fbf;&quot;&gt;&amp;nbsp;********************************************************************/&lt;/span&gt;&lt;/pre&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/h3&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-7979004486439013&quot;
     data-ad-slot=&quot;1962352932&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Output:&lt;/b&gt;&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXt_J_RnaMJdmHeKfSHHalRg3_HkC2gXie5Qa23B3iryxXmdjlZHdu8zPv-Kkh0gMMBa_dv4GAVNZShopPBuX4VXJ1czd5q3weT3cXOnBe3qCtFR7uslgTtol4KwA1uVqAF-J77fzKFs6y/s1600/hqdefault.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;360&quot; data-original-width=&quot;480&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXt_J_RnaMJdmHeKfSHHalRg3_HkC2gXie5Qa23B3iryxXmdjlZHdu8zPv-Kkh0gMMBa_dv4GAVNZShopPBuX4VXJ1czd5q3weT3cXOnBe3qCtFR7uslgTtol4KwA1uVqAF-J77fzKFs6y/s320/hqdefault.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/03/tic-tac-toe-game-using-c-program.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Jeu5hHuZknTiimF8NaXB99-gC0sHquxEvnXcl7-vhjwlr-GBxRhE45VL-xf6O1dyoLjgYxEIqjLxlmuesGUaWbKK0DRn_ayXoEHAM6aVHL1xKQ6w1zfZE0CQnChonOERTyjCRP6TShuM/s72-c/2000px-Tic_tac_toe.svg.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-619382913176012772</guid><pubDate>Sun, 25 Feb 2018 12:41:00 +0000</pubDate><atom:updated>2018-02-25T18:14:13.646+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">minimum spanning tree</category><category domain="http://www.blogger.com/atom/ns#">prim&#39;s algorithm</category><category domain="http://www.blogger.com/atom/ns#">prims algorithm</category><title>Prim’s Algorithm in C</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5KggFO18NcOMwgXdqwVPWi0wl2mb8BB0JSor78_fEwJxPBkBf3PuPd59-g3li8KNeroPPZlY5mvwHSzswK9aFf21AmtRuJLbZ5VssO8yiI9RBEBeg7hpsgNG3qGpG-4wZc5B_cH6pqV0/s1600/PrimAlgDemo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;226&quot; data-original-width=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5KggFO18NcOMwgXdqwVPWi0wl2mb8BB0JSor78_fEwJxPBkBf3PuPd59-g3li8KNeroPPZlY5mvwHSzswK9aFf21AmtRuJLbZ5VssO8yiI9RBEBeg7hpsgNG3qGpG-4wZc5B_cH6pqV0/s1600/PrimAlgDemo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Prim’s 
Algorithm is an approach to determine minimum cost spanning tree. In 
this case, we start with single edge of graph and we add edges to it and
 finally we get minimum cost tree. In this case, as well, we have n-1 
edges when number of nodes in graph are n.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;We
 again and again add edges to tree and tree is extended to create 
spanning tree, while in case of Kruskal’s algorithm there may be more 
than one tree, which is finally connected through edge to create 
spanning tree.&lt;/span&gt;&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;1962352932&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;h3&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Algorithm&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;This algorithm creates spanning tree with minimum weight from a given weighted graph.&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Begin&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Create edge list of given graph, with their weights.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Draw all nodes to create skeleton for spanning tree.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Select an edge with lowest weight and add it to skeleton and delete edge from edge list.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Add other 
edges. While adding an edge take care that the one end of the edge 
should always be in the skeleton tree and its cost should be minimum.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Repeat step 5 until n-1 edges are added.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Return. &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;C program for constructing a minimum cost spanning tree of a graph using Prim’s algorithm&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;overflow: scroll; width: 100%;&quot;&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdlib.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
 
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; infinity 9999&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; MAX 20&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;spanning&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; prims&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;total_cost&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter no. of vertices:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the adjacency matrix:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    total_cost&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;prims&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;spanning tree matrix:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;spanning&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Total cost of spanning tree=&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;total_cost&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; prims&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; u&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;min_distance&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;from&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; visited&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;no_of_edges&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;min_cost&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;j&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//create cost[][] matrix,spanning[][]&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
                cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;infinity&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
                cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                spanning&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        
    &lt;span style=&quot;color: dimgrey;&quot;&gt;//initialise visited[],distance[] and from[]&lt;/span&gt;
    distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    visited&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        from&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        visited&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    
    min_cost&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;//cost of spanning tree&lt;/span&gt;
    no_of_edges&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;//no. of edges to be added&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;no_of_edges&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//find the vertex at minimum distance from the tree&lt;/span&gt;
        min_distance&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;infinity&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;visited&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;min_distance&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                v&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;i&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                min_distance&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
            
        u&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;from&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//insert the edge in spanning tree&lt;/span&gt;
        spanning&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;u&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        spanning&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;u&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        no_of_edges&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        visited&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
        &lt;span style=&quot;color: dimgrey;&quot;&gt;//updated the distance[] array&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;visited&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                distance&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                from&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;v&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        
        min_cost&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;min_cost&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;u&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;min_cost&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Output&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Enter no. of vertices:6&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Enter the adjacency matrix:&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 3 1 6 0 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;3 0 5 0 3 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;1 5 0 5 6 4&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;6 0 5 0 0 2&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 3 6 0 0 6&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 0 4 2 6 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;spanning tree matrix:&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 3 1 0 0 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;3 0 0 0 3 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;1 0 0 0 0 4&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 0 0 0 0 2&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 3 0 0 0 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;0 0 4 2 0 0&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Total cost of spanning tree=13&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;1962352932&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/02/prims-algorithm-in-c.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5KggFO18NcOMwgXdqwVPWi0wl2mb8BB0JSor78_fEwJxPBkBf3PuPd59-g3li8KNeroPPZlY5mvwHSzswK9aFf21AmtRuJLbZ5VssO8yiI9RBEBeg7hpsgNG3qGpG-4wZc5B_cH6pqV0/s72-c/PrimAlgDemo.gif" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-3390023504687617004</guid><pubDate>Sat, 24 Feb 2018 09:09:00 +0000</pubDate><atom:updated>2018-03-02T17:37:22.573+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algorithm</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">kruskal&#39;s</category><category domain="http://www.blogger.com/atom/ns#">kruskals</category><category domain="http://www.blogger.com/atom/ns#">minimum spanning tree</category><title>C program for kruskal’s algorithm</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;It is an 
algorithm for finding the minimum cost spanning&amp;nbsp;tree of the given graph.
 In kruskal’s algorithm, edges are added to the spanning&amp;nbsp;&lt;span style=&quot;line-height: 1.5;&quot;&gt;tree in increasing order of cost. If the edge E forms a cycle in the spanning,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 1.5;&quot;&gt;it is discarded.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;1962352932&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Kruskal’s Algorithm&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;This algorithm will create spanning tree with minimum&amp;nbsp;weight, from a given weighted graph.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Begin&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Create the edge list of given graph, with their weights.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Sort the edge list according to their weights in ascending&amp;nbsp;order.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Draw all the nodes to create skeleton for spanning tree.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Pick up the edge at the top of the edge list (i.e. edge with&amp;nbsp;minimum weight).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Remove this edge from the edge list.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Connect the 
vertices in the skeleton with given edge. If by&amp;nbsp;connecting the vertices,
 a cycle is created in the skeleton, then discard this&amp;nbsp;edge.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Repeat steps 5 to 7, until n-1 edges are added or list of&amp;nbsp;edges is over.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;Return &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwGJLH9XRVbSQasDmW6-FyaTbIwTdQU2oYLaLE7QsMtPp_yDzy0cE4_q2xKxgPOhUWuJw87M_5bgE_GO37aIVidOnwY-vKkoJImyKwV0Dj6X4KbPWfB8Syl6JIlK9RpoBeU-CeoqpuOCQ/s1600/Animation+of+Kruskal%2527s+Algorithm.gif&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;600&quot; data-original-width=&quot;600&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwGJLH9XRVbSQasDmW6-FyaTbIwTdQU2oYLaLE7QsMtPp_yDzy0cE4_q2xKxgPOhUWuJw87M_5bgE_GO37aIVidOnwY-vKkoJImyKwV0Dj6X4KbPWfB8Syl6JIlK9RpoBeU-CeoqpuOCQ/s400/Animation+of+Kruskal%2527s+Algorithm.gif&quot; width=&quot;400&quot; /&gt;&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , sans-serif;&quot;&gt;C program for constructing a minimum cost spanning tree of&amp;nbsp;a graph using Kruskal’s algorithm:&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt; MAX 30&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; edge
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; u&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;w&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;edge&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;typedef&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;struct&lt;/span&gt; edgelist
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    edge data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;edgelist&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
edgelist elist&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
edgelist spanlist&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; kruskal&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; find&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; vertexno&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; union1&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; c1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; c2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; sort&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;total_cost&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter number of vertices:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the adjacency matrix:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            
    kruskal&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; kruskal&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;MAX&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;cno1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;cno2&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
 
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;i&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;u&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;i&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;j&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;w&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;G&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
    sort&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;i&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        cno1&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;find&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;belongs&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;u&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        cno2&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;find&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;belongs&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;cno1&lt;span style=&quot;color: #808030;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;cno2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            union1&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;belongs&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;cno1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;cno2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; find&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; vertexno&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;vertexno&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; union1&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; c1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; c2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; i&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;c2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            belongs&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;c1&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; sort&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;j&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    edge temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;w&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;w&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
                temp&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
                elist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;j&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;temp&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; print&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;n&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;u&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;v&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;w&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        cost&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;spanlist&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;data&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;w&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
 
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Cost of the spanning tree=&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;cost&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2au3IzRbBev3Zdt3-oN9zvTvZQI7bTBSQ7E3P4H8yxDFhkTyof3-8RFjn8US8UJns4VaFz6YX6Zg1umq-Z3OEG-a8s9410IOtiABUo1CK71X4DisNhyphenhyphen9NazpJLzP32xAiZiUOlfvjOKU/s1600/Kruskal%25E2%2580%2599s+Algorithm+for+Finding+Minimum+Cost+Spanning+Tree.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;546&quot; data-original-width=&quot;840&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2au3IzRbBev3Zdt3-oN9zvTvZQI7bTBSQ7E3P4H8yxDFhkTyof3-8RFjn8US8UJns4VaFz6YX6Zg1umq-Z3OEG-a8s9410IOtiABUo1CK71X4DisNhyphenhyphen9NazpJLzP32xAiZiUOlfvjOKU/s640/Kruskal%25E2%2580%2599s+Algorithm+for+Finding+Minimum+Cost+Spanning+Tree.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Output Screenshot&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/02/c-program-for-kruskals-algorithm.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwGJLH9XRVbSQasDmW6-FyaTbIwTdQU2oYLaLE7QsMtPp_yDzy0cE4_q2xKxgPOhUWuJw87M_5bgE_GO37aIVidOnwY-vKkoJImyKwV0Dj6X4KbPWfB8Syl6JIlK9RpoBeU-CeoqpuOCQ/s72-c/Animation+of+Kruskal%2527s+Algorithm.gif" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-1291089072615686963</guid><pubDate>Sat, 17 Feb 2018 05:02:00 +0000</pubDate><atom:updated>2018-02-17T10:32:21.374+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">author name</category><category domain="http://www.blogger.com/atom/ns#">blogger</category><category domain="http://www.blogger.com/atom/ns#">change</category><title>How to change post author name in blogger</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #666666; font-family: &amp;quot;Trebuchet MS&amp;quot;, Trebuchet, Verdana, sans-serif; font-size: 24.48px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: normal; line-height: normal; margin: 0px; position: relative; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: 15.84px; text-align: justify;&quot;&gt;Publishing new post will display the Author&#39;s Name and some of the templates will display the Author&#39;s Name and can click it to redirect to the author profile page.In this tutorial I will teach you how to change your Author&#39;s Name whenever you are posting or viewing your post and change or remove the redirect.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;post-body entry-content&quot; id=&quot;post-body-5632995457584486102&quot; itemprop=&quot;articleBody&quot; style=&quot;background-color: white; color: #666666; font-family: &amp;quot;Trebuchet MS&amp;quot;, Trebuchet, Verdana, sans-serif; font-size: 15.84px; line-height: 1.3; position: relative; width: 340px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Follow the step by step instruction below to change the author name in your blog.&lt;/div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRr8qg-tZJpHFxqiW8AZ049tMwvVcMAtSLkljvvD1bo9Rg4EDQ3wW6K7YVnFT3BehkCOdIaB7mtKJLItP6bFtXQ_R-vFyRnouI3a5VFPiYj-v6HVokyZiuNJo5Lf4dD_NYTWrF0NklFpU/s1600/jkljkljkl.png&quot; imageanchor=&quot;1&quot; style=&quot;color: #888888; text-decoration-line: none;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;39&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRr8qg-tZJpHFxqiW8AZ049tMwvVcMAtSLkljvvD1bo9Rg4EDQ3wW6K7YVnFT3BehkCOdIaB7mtKJLItP6bFtXQ_R-vFyRnouI3a5VFPiYj-v6HVokyZiuNJo5Lf4dD_NYTWrF0NklFpU/s200/jkljkljkl.png&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.1) 1px 1px 5px; box-sizing: border-box; max-width: 100%; padding: 5px; position: relative;&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;margin: 0px; position: relative; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h3 style=&quot;margin: 0px; position: relative; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;First:&lt;/span&gt;&lt;/b&gt;&amp;nbsp;How to change the Author&#39;s Name.&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;i&gt;Step 1:&amp;nbsp;&lt;/i&gt;&lt;/b&gt;Go to your blogger dashboard.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;/i&gt;&amp;nbsp;Click on&amp;nbsp;&lt;i&gt;&lt;b&gt;Template.&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i style=&quot;font-weight: bold;&quot;&gt;Step 3:&amp;nbsp;&lt;/i&gt;Click on&amp;nbsp;&lt;i&gt;&lt;b&gt;Edit&amp;nbsp;&lt;/b&gt;&lt;b&gt;HTML&lt;/b&gt;&lt;/i&gt;&amp;nbsp;and click inside the box&lt;b style=&quot;font-style: italic;&quot;&gt;.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i&gt;&lt;b&gt;Step 4:&lt;/b&gt;&lt;/i&gt;&amp;nbsp;Press Ctrl+F to search for&amp;nbsp;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;&amp;nbsp;&lt;/b&gt;- This is the author name.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;i&gt;Step 5:&lt;/i&gt;&lt;/b&gt;&amp;nbsp;Change&amp;nbsp;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;&amp;nbsp;&lt;/b&gt;into something else like&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Admin.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Search for all the&amp;nbsp;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;&amp;nbsp;&lt;/b&gt;you can find and change all of them into the name you want to display in your blog. Congratulations! well done! do not forget to save your work by clicking the&amp;nbsp;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;Save Template&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&amp;nbsp;button on the upper left of the box.&lt;/div&gt;
&lt;br /&gt;&lt;h3 style=&quot;margin: 0px; position: relative; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;Second:&lt;/span&gt;&amp;nbsp;&lt;/b&gt;Change or Remove the redirect link when clicking the Author&#39;s Name.&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
After searching for&amp;nbsp;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
if you can see&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;a href=&quot;&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;Redirect Site&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;color: #990000; font-weight: bold;&quot;&gt;&amp;lt;/a&amp;gt;&amp;nbsp;&lt;/span&gt;something like this.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
then let us continue.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Remove Redirect Link:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;i style=&quot;font-weight: bold;&quot;&gt;Step 1:&amp;nbsp;&lt;/i&gt;Remove or&amp;nbsp;Delete&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;a href=&quot;&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;Redirect Site&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&amp;gt; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000; font-weight: bold;&quot;&gt;&amp;lt;/a&amp;gt;&amp;nbsp;&lt;/span&gt;and remain the&amp;nbsp;&lt;b&gt;&amp;lt;data:post.author/&amp;gt;&amp;nbsp;&lt;/b&gt;or the Author Name.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;i&gt;Step 2:&lt;/i&gt;&amp;nbsp;&lt;/b&gt;Save Template! and check it. you can&#39;t click the Author Name.&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Change Redirect Link:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Step 1:&amp;nbsp;&lt;/b&gt;Change the&amp;nbsp;&lt;span style=&quot;color: #bf9000;&quot;&gt;Redirect Site&amp;nbsp;&lt;/span&gt;into the site where you want to Redirect whenever clicking the Author&#39;s Name.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;i&gt;Step 2:&lt;/i&gt;&amp;nbsp;&lt;/b&gt;Save Template! and check it. When clicking the Author&#39;s Name will Redirect into the Page you put.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;Thanks For Reading! Have a Nice Day!&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/02/how-to-change-post-author-name-in.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRr8qg-tZJpHFxqiW8AZ049tMwvVcMAtSLkljvvD1bo9Rg4EDQ3wW6K7YVnFT3BehkCOdIaB7mtKJLItP6bFtXQ_R-vFyRnouI3a5VFPiYj-v6HVokyZiuNJo5Lf4dD_NYTWrF0NklFpU/s72-c/jkljkljkl.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-3312034193588974882</guid><pubDate>Fri, 09 Feb 2018 04:04:00 +0000</pubDate><atom:updated>2018-02-09T18:59:42.529+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">smiley program</category><title>C program to Print Smiley on Screen</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;To print smiling face on the screen in C programming, use the ASCII value of smiling face which is 1.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;Following C program ask to the user that how many smiling face he or she want to print on the screen to print the required number of smiling face on the screen:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;************Source*Code**************&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;stdio&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;h&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;conio&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;h&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
  &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; sml&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; limit&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;How many smiley face you want to print ? &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;limit&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;limit&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
       &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007997;&quot;&gt;%c&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;sml&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;pre style=&quot;color: #333333; line-height: 16.25px;&quot;&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;****************Output*****************&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW6QSnjzJUXZYrIIaBhgtlI_66eig-DIxZLeeVwF9I2fbjiwkc2GbUQEdj0I-tf5AIGxtJAbZPGEHgnGEZbhNMy0te7Q9GIRdpKgep6LuHkoSq4Z6QS_sQbvFB7ipiE2vw5jqGnPXoIxU/s1600/c-program-print-smiling-face.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;242&quot; data-original-width=&quot;644&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW6QSnjzJUXZYrIIaBhgtlI_66eig-DIxZLeeVwF9I2fbjiwkc2GbUQEdj0I-tf5AIGxtJAbZPGEHgnGEZbhNMy0te7Q9GIRdpKgep6LuHkoSq4Z6QS_sQbvFB7ipiE2vw5jqGnPXoIxU/s400/c-program-print-smiling-face.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;screenshot&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 12.635px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/02/c-program-to-print-smiley-on-screen.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW6QSnjzJUXZYrIIaBhgtlI_66eig-DIxZLeeVwF9I2fbjiwkc2GbUQEdj0I-tf5AIGxtJAbZPGEHgnGEZbhNMy0te7Q9GIRdpKgep6LuHkoSq4Z6QS_sQbvFB7ipiE2vw5jqGnPXoIxU/s72-c/c-program-print-smiling-face.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-3416471196128023969</guid><pubDate>Sun, 21 Jan 2018 09:10:00 +0000</pubDate><atom:updated>2018-02-10T08:06:51.118+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">best c IDE</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">CLion</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">Eclipse</category><category domain="http://www.blogger.com/atom/ns#">Netbeans</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">Xcode</category><title>Best IDE for C/C++ programming</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
Here is a list of some very good C/C++ IDEs. You should select the one which fits your needs. If you are a beginner then try your hands at TurboC++, otherwise take a look at these.&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
1)&amp;nbsp;&lt;span class=&quot;qlink_container&quot; style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;external_link&quot; href=&quot;https://www.jetbrains.com/clion/&quot; mobile_app_target=&quot;browser&quot; rel=&quot;noopener nofollow&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); background: url(&amp;quot;//qsf.fs.quoracdn.net/-3-images.new_grid.external_link.svg-26-aef78ead48f1f1e2.svg&amp;quot;) right 0.3em / 10.5px no-repeat; color: #2b6dad; margin: 0px; outline: 0px; padding: 0px 15px 0px 0px; text-decoration-line: none; user-select: none;&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;CLion&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_image_wrapper&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; line-height: 0; margin: 0px 0px 1em; outline: 0px; padding: 0px; position: relative;&quot;&gt;
&lt;a href=&quot;https://qph.ec.quoracdn.net/main-qimg-2b3fc7e334d1e289e43bd3e6d0e72a25&quot; mobile_app_target=&quot;external&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); color: #2b6dad; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; user-select: none;&quot;&gt;&lt;canvas class=&quot;ui_qtext_image_placeholder landscape ui_qtext_image zoomable_in zoomable_in_feed&quot; height=&quot;308.6395939086294&quot; style=&quot;border-radius: 3px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; visibility: hidden;&quot; width=&quot;602.0&quot;&gt;&lt;/canvas&gt;&lt;img class=&quot;landscape ui_qtext_image zoomable_in zoomable_in_feed lazy_loaded lazy_loading&quot; master_h=&quot;505&quot; master_src=&quot;https://qph.ec.quoracdn.net/main-qimg-2b3fc7e334d1e289e43bd3e6d0e72a25&quot; master_w=&quot;985&quot; src=&quot;https://qph.ec.quoracdn.net/main-qimg-fb6cda93cb05c3ea8b316edefde8d2eb&quot; src_h=&quot;309&quot; src_w=&quot;602&quot; style=&quot;animation-duration: 0.001s; animation-name: insQ_100; border-radius: 3px; color: transparent; left: 0px; margin: 0px; max-width: 100%; opacity: 1; outline: 0px; padding: 0px; position: absolute; top: 0px; transition: opacity 0.5s linear;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Platforms&lt;/b&gt;: Linux, Mac OS X, Windows&lt;br /&gt;
JetBrains, a well-known company has created this IDE for C/C++ developers.&lt;/div&gt;
&lt;ul style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; list-style-image: initial; list-style-position: initial; margin: 0px 2em 1em 0px; outline: 0px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Smart editor&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Embedded terminal&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Various languages and standards: C++11, libc++, boost, JavaScript, XML, HTML and CSS&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Keyboard Shortcuts to help you with fast project creating&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;CMake support&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px; position: relative;&quot;&gt;Code analysis&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
Why it&#39;s a number one? Well, because it has a multi-platform support first of all and a has a lot of functions which will help us in developing.&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
2)&amp;nbsp;&lt;span class=&quot;qlink_container&quot; style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;external_link&quot; href=&quot;https://www.visualstudio.com/&quot; mobile_app_target=&quot;browser&quot; rel=&quot;noopener nofollow&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); background: url(&amp;quot;//qsf.fs.quoracdn.net/-3-images.new_grid.external_link.svg-26-aef78ead48f1f1e2.svg&amp;quot;) right 0.3em / 10.5px no-repeat; color: #2b6dad; margin: 0px; outline: 0px; padding: 0px 15px 0px 0px; text-decoration-line: none; user-select: none;&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Visual Studio&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_image_wrapper&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; line-height: 0; margin: 0px 0px 1em; outline: 0px; padding: 0px; position: relative;&quot;&gt;
&lt;a href=&quot;https://qph.ec.quoracdn.net/main-qimg-7f39571dbd0b24deb48d7ff96d9efcb6&quot; mobile_app_target=&quot;external&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); color: #2b6dad; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; user-select: none;&quot;&gt;&lt;canvas class=&quot;ui_qtext_image_placeholder landscape ui_qtext_image zoomable_in zoomable_in_feed&quot; height=&quot;320.8316251830161&quot; style=&quot;border-radius: 3px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; visibility: hidden;&quot; width=&quot;602.0&quot;&gt;&lt;/canvas&gt;&lt;img class=&quot;landscape ui_qtext_image zoomable_in zoomable_in_feed lazy_loaded lazy_loading&quot; master_h=&quot;728&quot; master_src=&quot;https://qph.ec.quoracdn.net/main-qimg-7f39571dbd0b24deb48d7ff96d9efcb6&quot; master_w=&quot;1366&quot; src=&quot;https://qph.ec.quoracdn.net/main-qimg-4e8b55a86cd4e63f29bbb9e0d77541d6&quot; src_h=&quot;321&quot; src_w=&quot;602&quot; style=&quot;animation-duration: 0.001s; animation-name: insQ_100; border-radius: 3px; color: transparent; left: 0px; margin: 0px; max-width: 100%; opacity: 1; outline: 0px; padding: 0px; position: absolute; top: 0px; transition: opacity 0.5s linear;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Platforms&lt;/b&gt;: Windows&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
IDE from Microsoft. The only minus about this IDE that it only works with Windows. This IDE is not only for C/C++ developers, but it also includes many popular languages in its list. If you are working with a team then you probably do need a Pro version minimum which is not free. But if you are working alone then you can use Express edition of IDE which is free.&lt;/div&gt;
&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-layout-key=&quot;-cu+3x+89-a0&quot;
     data-ad-client=&quot;ca-pub-7979004486439013&quot;
     data-ad-slot=&quot;7127878345&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
3)&amp;nbsp;&lt;span class=&quot;qlink_container&quot; style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;external_link&quot; href=&quot;https://developer.apple.com/xcode/&quot; mobile_app_target=&quot;browser&quot; rel=&quot;noopener nofollow&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); background: url(&amp;quot;//qsf.fs.quoracdn.net/-3-images.new_grid.external_link.svg-26-aef78ead48f1f1e2.svg&amp;quot;) right 0.3em / 10.5px no-repeat; color: #2b6dad; margin: 0px; outline: 0px; padding: 0px 15px 0px 0px; text-decoration-line: none; user-select: none;&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Xcode&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_image_wrapper&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; line-height: 0; margin: 0px 0px 1em; outline: 0px; padding: 0px; position: relative;&quot;&gt;
&lt;a href=&quot;https://qph.ec.quoracdn.net/main-qimg-58f5bb38e852d4330384e969baa8dcad&quot; mobile_app_target=&quot;external&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); color: #2b6dad; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; user-select: none;&quot;&gt;&lt;canvas class=&quot;ui_qtext_image_placeholder landscape ui_qtext_image zoomable_in zoomable_in_feed&quot; height=&quot;340.75471698113205&quot; style=&quot;border-radius: 3px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; visibility: hidden;&quot; width=&quot;602.0&quot;&gt;&lt;/canvas&gt;&lt;img class=&quot;landscape ui_qtext_image zoomable_in zoomable_in_feed lazy_loaded lazy_loading&quot; master_h=&quot;600&quot; master_src=&quot;https://qph.ec.quoracdn.net/main-qimg-58f5bb38e852d4330384e969baa8dcad&quot; master_w=&quot;1060&quot; src=&quot;https://qph.ec.quoracdn.net/main-qimg-3d01dcc7ab2c7888be775e2bf302d950&quot; src_h=&quot;341&quot; src_w=&quot;602&quot; style=&quot;animation-duration: 0.001s; animation-name: insQ_100; border-radius: 3px; color: transparent; left: 0px; margin: 0px; max-width: 100%; opacity: 1; outline: 0px; padding: 0px; position: absolute; top: 0px; transition: opacity 0.5s linear;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Platforms&lt;/b&gt;: Mac OS X&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
This IDE is the best choice for Mac users. Probably there are so many programmers who prefer to use a Mac. And again this IDE like the previous one (Visual Studio) is not only for C/C++ developers, there are many other popular languages supported. It is completely free to use. So you get pretty cool features to develop your program with C/C++.&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
4)&amp;nbsp;&lt;span class=&quot;qlink_container&quot; style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;external_link&quot; href=&quot;http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/mars1&quot; mobile_app_target=&quot;browser&quot; rel=&quot;noopener nofollow&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); background: url(&amp;quot;//qsf.fs.quoracdn.net/-3-images.new_grid.external_link.svg-26-aef78ead48f1f1e2.svg&amp;quot;) right 0.3em / 10.5px no-repeat; color: #2b6dad; margin: 0px; outline: 0px; padding: 0px 15px 0px 0px; text-decoration-line: none; user-select: none;&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Eclipse&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_image_wrapper&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; line-height: 0; margin: 0px 0px 1em; outline: 0px; padding: 0px; position: relative;&quot;&gt;
&lt;a href=&quot;https://qph.ec.quoracdn.net/main-qimg-e98181abbf23061961574bb8c754dbc0&quot; mobile_app_target=&quot;external&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); color: #2b6dad; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; user-select: none;&quot;&gt;&lt;canvas class=&quot;ui_qtext_image_placeholder landscape ui_qtext_image zoomable_in zoomable_in_feed&quot; height=&quot;375.70072992700733&quot; style=&quot;border-radius: 3px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; visibility: hidden;&quot; width=&quot;602.0&quot;&gt;&lt;/canvas&gt;&lt;img class=&quot;landscape ui_qtext_image zoomable_in zoomable_in_feed lazy_loaded lazy_loading&quot; master_h=&quot;855&quot; master_src=&quot;https://qph.ec.quoracdn.net/main-qimg-e98181abbf23061961574bb8c754dbc0&quot; master_w=&quot;1370&quot; src=&quot;https://qph.ec.quoracdn.net/main-qimg-2c2cb54f9953f1c09e20850bfa961e6b&quot; src_h=&quot;376&quot; src_w=&quot;602&quot; style=&quot;animation-duration: 0.001s; animation-name: insQ_100; border-radius: 3px; color: transparent; left: 0px; margin: 0px; max-width: 100%; opacity: 1; outline: 0px; padding: 0px; position: absolute; top: 0px; transition: opacity 0.5s linear;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Platforms&lt;/b&gt;: Linux, Mac OS X, Windows&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
The second good IDE which has a multi-platform support. It is also open source which is a big plus and completely free.&lt;/div&gt;
&lt;ul style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; list-style-image: initial; list-style-position: initial; margin: 0px 2em 1em 0px; outline: 0px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;C/C++ Development Tools&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Eclipse Git Team Provider&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Mylyn Task List&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px; position: relative;&quot;&gt;Remote System Explorer&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
5)&amp;nbsp;&lt;span class=&quot;qlink_container&quot; style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;external_link&quot; href=&quot;https://netbeans.org/features/cpp/&quot; mobile_app_target=&quot;browser&quot; rel=&quot;noopener nofollow&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); background: url(&amp;quot;//qsf.fs.quoracdn.net/-3-images.new_grid.external_link.svg-26-aef78ead48f1f1e2.svg&amp;quot;) right 0.3em / 10.5px no-repeat; color: #2b6dad; margin: 0px; outline: 0px; padding: 0px 15px 0px 0px; text-decoration-line: none; user-select: none;&quot; target=&quot;_blank&quot;&gt;&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;NetBeans IDE&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_image_wrapper&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; line-height: 0; margin: 0px 0px 1em; outline: 0px; padding: 0px; position: relative;&quot;&gt;
&lt;a href=&quot;https://qph.ec.quoracdn.net/main-qimg-dc1729242ec3eb12ffd7229bc1e217d9&quot; mobile_app_target=&quot;external&quot; style=&quot;-webkit-tap-highlight-color: rgba(34, 106, 173, 0.1); color: #2b6dad; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; user-select: none;&quot;&gt;&lt;canvas class=&quot;ui_qtext_image_placeholder landscape ui_qtext_image zoomable_in zoomable_in_feed&quot; height=&quot;444.99839999999995&quot; style=&quot;border-radius: 3px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; visibility: hidden;&quot; width=&quot;602.0&quot;&gt;&lt;/canvas&gt;&lt;img class=&quot;landscape ui_qtext_image zoomable_in zoomable_in_feed lazy_loaded lazy_loading&quot; master_h=&quot;462&quot; master_src=&quot;https://qph.ec.quoracdn.net/main-qimg-dc1729242ec3eb12ffd7229bc1e217d9&quot; master_w=&quot;625&quot; src=&quot;https://qph.ec.quoracdn.net/main-qimg-c8693a9cb4afbe05c080d07d21e8b029&quot; src_h=&quot;445&quot; src_w=&quot;602&quot; style=&quot;animation-duration: 0.001s; animation-name: insQ_100; border-radius: 3px; color: transparent; left: 0px; margin: 0px; max-width: 100%; opacity: 1; outline: 0px; padding: 0px; position: absolute; top: 0px; transition: opacity 0.5s linear;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
&lt;b style=&quot;margin: 0px; outline: 0px; padding: 0px;&quot;&gt;Platforms&lt;/b&gt;: Linux, Mac OS X, Windows&lt;/div&gt;
&lt;div class=&quot;ui_qtext_para&quot; style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; margin-bottom: 1em; outline: 0px; padding: 0px;&quot;&gt;
Multi-platform, free IDE. Has a lot good feature which can help you in development.&lt;/div&gt;
&lt;ul style=&quot;background-color: white; color: #333333; font-family: q_serif, Georgia, Times, &amp;quot;Times New Roman&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Meiryo, serif; font-size: 15px; list-style-image: initial; list-style-position: initial; margin: 0px 2em 1em 0px; outline: 0px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;C++11 Support&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Qt Toolkit Support&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;Remote Development&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px 0px 0.7em; position: relative;&quot;&gt;File Navigation&lt;/li&gt;
&lt;li style=&quot;margin: 5px 0px 5px 2em; outline: 0px; padding: 0px; position: relative;&quot;&gt;Compiler Configurations&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/01/topcide.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-1019723350936481860</guid><pubDate>Mon, 15 Jan 2018 13:11:00 +0000</pubDate><atom:updated>2020-12-16T14:11:04.537+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c array programs</category><category domain="http://www.blogger.com/atom/ns#">c games</category><category domain="http://www.blogger.com/atom/ns#">c questions</category><category domain="http://www.blogger.com/atom/ns#">interview questions</category><category domain="http://www.blogger.com/atom/ns#">matrix questions in c</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">spiral matrix</category><title>Spiral matrix in C</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;A spiral matrix is a matrix of the type which puts numbers in a circular fashion rather than in row-major or column-major fashion.&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
This is the spiral matrix in which one has stored value in clockwise and other one in anticlockwise:&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht6mNVnYnxkjo8w9FHQvCh4BX1rXrHB2Y8OFQVovLp-1nxnvE7ZKVV5pFC3697x9dmVrdFyCD06B8GMMNrK-cboAKC4eW6L17FKZp7tKTMh0FJ3tNtSljWZh2GbhkKiABNX4cVrRdLLmA/s1600/SpiralMatrix.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;415&quot; data-original-width=&quot;702&quot; height=&quot;236&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht6mNVnYnxkjo8w9FHQvCh4BX1rXrHB2Y8OFQVovLp-1nxnvE7ZKVV5pFC3697x9dmVrdFyCD06B8GMMNrK-cboAKC4eW6L17FKZp7tKTMh0FJ3tNtSljWZh2GbhkKiABNX4cVrRdLLmA/s400/SpiralMatrix.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
******************************Source code**********************************&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #011627; color: #d6deeb; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;define&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;UP&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;define&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;DOWN&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;define&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;LEFT&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;define&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;RIGHT&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;define&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;MAX&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;6&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; UP , n &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; MAX , p &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt; ;    &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt; intial_direction is set to UP because we need to start moving right&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; r ,c , a[MAX][MAX];&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; row_right  &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; , column_down &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; n&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt; , row_left &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; n&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt; , column_up &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Set all elements of the matrix to 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(r &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; r &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt; MAX ; r&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(c &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; c &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt; MAX ; c&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;        a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Generate elements of the spiral matrix&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;while&lt;/span&gt;(p &lt;span style=&quot;color: #c792ea;&quot;&gt;!=&lt;/span&gt; n&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;n&lt;span style=&quot;color: #7fdbca;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; UP)&lt;/div&gt;&lt;div&gt;          {&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Move RIGHT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            r &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; row_right&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt; ;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(c &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; c &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt; n ; c&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;            {&lt;/div&gt;&lt;div&gt;                &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;                a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; p&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;            initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; RIGHT ;&lt;/div&gt;&lt;div&gt;          }&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; RIGHT)&lt;/div&gt;&lt;div&gt;          {&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Move down&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            c &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; column_down&lt;span style=&quot;color: #7fdbca;&quot;&gt;--&lt;/span&gt; ;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(r &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; r &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt; n ; r&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;            {&lt;/div&gt;&lt;div&gt;                &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;                a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; p&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;            initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; DOWN ;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;          }&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; DOWN)&lt;/div&gt;&lt;div&gt;          {&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Move left&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            r &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; row_left&lt;span style=&quot;color: #7fdbca;&quot;&gt;--&lt;/span&gt; ;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(c &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; n&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt; ; c &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; c&lt;span style=&quot;color: #7fdbca;&quot;&gt;--&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;            {&lt;/div&gt;&lt;div&gt;                &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;                a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; p&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;            initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; LEFT ;&lt;/div&gt;&lt;div&gt;          }&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; LEFT)&lt;/div&gt;&lt;div&gt;          {&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Move up&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            c &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; column_up&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(r &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; n&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt; ; r &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; r&lt;span style=&quot;color: #7fdbca;&quot;&gt;--&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;            {&lt;/div&gt;&lt;div&gt;                &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;if&lt;/span&gt;(a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;                a[r][c] &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; p&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;            initial_direction &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; UP ;&lt;/div&gt;&lt;div&gt;          }&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;Print the matrix&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n\n&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(r &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; r &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt; MAX ; r&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(c &lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt; ; c &lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt; MAX ; c&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%4d&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,a[r][c]);&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;/div&gt;
********************************Output**********************************&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTcAZTC0CjZCqIfRxVeFFJSoqqpWnmrdTVzT5rIMJ36ohiBG6hU-JvJwrZBSipz_GwLACcGL3feoayI75v1D_gKdryIehvVqpMJodYmHBcW2nSRUMDWfrgY4XIc_hwK_Cryo135mNk5M4/s1600/spirl.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;205&quot; data-original-width=&quot;257&quot; height=&quot;319&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTcAZTC0CjZCqIfRxVeFFJSoqqpWnmrdTVzT5rIMJ36ohiBG6hU-JvJwrZBSipz_GwLACcGL3feoayI75v1D_gKdryIehvVqpMJodYmHBcW2nSRUMDWfrgY4XIc_hwK_Cryo135mNk5M4/s400/spirl.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2018/01/c-program-to-print-spiral-matrix.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht6mNVnYnxkjo8w9FHQvCh4BX1rXrHB2Y8OFQVovLp-1nxnvE7ZKVV5pFC3697x9dmVrdFyCD06B8GMMNrK-cboAKC4eW6L17FKZp7tKTMh0FJ3tNtSljWZh2GbhkKiABNX4cVrRdLLmA/s72-c/SpiralMatrix.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-665430977173587129</guid><pubDate>Fri, 22 Dec 2017 15:50:00 +0000</pubDate><atom:updated>2021-08-22T10:53:19.319+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c basics</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">capitalize the string in c</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">string in c</category><title>C program to Capitalize the String</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Capitalize a String or a sentence means to make the first letter of each word upper case.&lt;br /&gt;
&lt;br /&gt;
We try to achieve the same using the &lt;a href=&quot;http://dotcprograms.blogspot.com&quot;&gt;C program&lt;/a&gt; here&lt;br /&gt;
&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout-key=&quot;-cu+3x+89-a0&quot; data-ad-slot=&quot;7127878345&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;span style=&quot;color: red;&quot;&gt;*************************PROGRAM************&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&amp;nbsp;MAX&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;100&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;char&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[MAX]={&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;};&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;nbsp;i;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//input&amp;nbsp;string&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Enter&amp;nbsp;a&amp;nbsp;string:&amp;nbsp;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f44747;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;[^&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;]s&quot;&lt;/span&gt;,str);&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//read&amp;nbsp;string&amp;nbsp;with&amp;nbsp;spaces&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//capitalize&amp;nbsp;first&amp;nbsp;character&amp;nbsp;of&amp;nbsp;words&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(i=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]!=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\0&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;;&amp;nbsp;i++)&lt;/div&gt;&lt;div&gt;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//check&amp;nbsp;first&amp;nbsp;character&amp;nbsp;is&amp;nbsp;lowercase&amp;nbsp;alphabet&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(i==&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;((&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]&amp;gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;a&#39;&lt;/span&gt;&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]&amp;lt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;z&#39;&lt;/span&gt;))&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]=&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]-&lt;span style=&quot;color: #b5cea8;&quot;&gt;32&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//subtract&amp;nbsp;32&amp;nbsp;to&amp;nbsp;make&amp;nbsp;it&amp;nbsp;capital&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;continue&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//continue&amp;nbsp;to&amp;nbsp;the&amp;nbsp;loop&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]==&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&amp;nbsp;&#39;&lt;/span&gt;)&lt;span style=&quot;color: #6a9955;&quot;&gt;//check&amp;nbsp;space&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//if&amp;nbsp;space&amp;nbsp;is&amp;nbsp;found,&amp;nbsp;check&amp;nbsp;next&amp;nbsp;character&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;++i;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//check&amp;nbsp;next&amp;nbsp;character&amp;nbsp;is&amp;nbsp;lowercase&amp;nbsp;alphabet&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]&amp;gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;a&#39;&lt;/span&gt;&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]&amp;lt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;z&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]=&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]-&lt;span style=&quot;color: #b5cea8;&quot;&gt;32&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//subtract&amp;nbsp;32&amp;nbsp;to&amp;nbsp;make&amp;nbsp;it&amp;nbsp;capital&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;continue&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//continue&amp;nbsp;to&amp;nbsp;the&amp;nbsp;loop&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//all&amp;nbsp;other&amp;nbsp;uppercase&amp;nbsp;characters&amp;nbsp;should&amp;nbsp;be&amp;nbsp;in&amp;nbsp;lowercase&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]&amp;gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;A&#39;&lt;/span&gt;&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]&amp;lt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;Z&#39;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]=&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]+&lt;span style=&quot;color: #b5cea8;&quot;&gt;32&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;color: #6a9955;&quot;&gt;//subtract&amp;nbsp;32&amp;nbsp;to&amp;nbsp;make&amp;nbsp;it&amp;nbsp;small/lowercase&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Capitalize&amp;nbsp;string&amp;nbsp;is:&amp;nbsp;%s&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;,str);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: purple;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: purple;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout-key=&quot;-cu+3x+89-a0&quot; data-ad-slot=&quot;7127878345&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;*************************OUTPUT*******************************&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255);&quot;&gt;&lt;pre class=&quot;w3-output&quot; style=&quot;background-color: black; box-sizing: border-box; color: white; font-family: monospace, monospace; font-size: 16.5px; line-height: 1.2; overflow: auto; padding: 5px;&quot;&gt;First run:
Enter a string: HELLO FRIENDS HOW ARE YOU?
Capitalize string is: Hello Friends How Are You?

Second run:
Enter a string: hello friends how are you?
Capitalize string is: Hello Friends How Are You?

Third run:
Enter a string: 10 ways to learn programming.
Capitalize string is: 10 Ways To Learn Programming.&lt;/pre&gt;
&lt;/pre&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2017/12/c-program-to-capitalize-string.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-3150187450035999924</guid><pubDate>Sat, 16 Dec 2017 14:35:00 +0000</pubDate><atom:updated>2017-12-16T20:05:29.249+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c basics</category><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">interview questions</category><category domain="http://www.blogger.com/atom/ns#">recursion in c</category><title>Sum of Two numbers using recursion function in C</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;How to add two number using recursion function in C?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Solution:&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; &lt;span style=&quot;color: #a31515;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; main(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;
argc, &lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt; *argv[]){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; a,b;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; scanf(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%d%d&quot;&lt;/span&gt;,&amp;amp;a,&amp;amp;b);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
printf(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%d&quot;&lt;/span&gt;,sum(a,b));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; 0;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-size: 14pt;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt; sum(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; a,&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; b){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; s=0;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(b &amp;gt; 0){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s++;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(a,b-1);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(a&amp;gt;0){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s++;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(a-1,b);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; s;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2017/12/sum-of-two-numbers-using-recursion.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-8696083247842222898</guid><pubDate>Wed, 04 Oct 2017 14:23:00 +0000</pubDate><atom:updated>2021-08-22T11:20:30.881+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">malloc in c</category><category domain="http://www.blogger.com/atom/ns#">string in c</category><category domain="http://www.blogger.com/atom/ns#">string reverse prgram</category><category domain="http://www.blogger.com/atom/ns#">strrev()</category><title>Reverse string in C without using strrev() function</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It&#39;s a &lt;a href=&quot;http://dotcprograms.blogspot.in/&quot;&gt;C program&lt;/a&gt;&amp;nbsp;that explains how to reverse a given string without using the inbuilt function &#39;&lt;span style=&quot;background-color: #f1c232;&quot;&gt;strrev()&lt;/span&gt;&#39; which is a part of the&amp;nbsp;&lt;span style=&quot;background-color: #f1c232;&quot;&gt;#include&amp;lt;string.h&amp;gt;&lt;/span&gt; header file.&lt;br /&gt;
&lt;br /&gt;
It is very simple to reverse a string by using &lt;span style=&quot;background-color: #f1c232;&quot;&gt;strrev()&lt;/span&gt; function in c:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255); color: black;&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;string.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;(){&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;char&lt;/span&gt;&amp;nbsp;*str,*str2;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;str&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;malloc&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;sizeof&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;char&lt;/span&gt;*));&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;str2&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;malloc&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;sizeof&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;char&lt;/span&gt;*));&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;%s&quot;&lt;/span&gt;,str);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;str2&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;strrev&lt;/span&gt;(str);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Reverse&amp;nbsp;of&amp;nbsp;%s&amp;nbsp;is&amp;nbsp;%s&quot;&lt;/span&gt;,str,str2);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;

  &lt;br/&gt;
&lt;span id=&quot;goog_113869499&quot;&gt;&lt;/span&gt;Else you can do it as below without using &lt;span style=&quot;background-color: #f1c232;&quot;&gt;strrev()&lt;/span&gt; function:&lt;/div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: rgb(255, 255, 255); color: black;&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;(){&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;char&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[&lt;span style=&quot;color: #b5cea8;&quot;&gt;100&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;nbsp;i=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;,n=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;%s&quot;&lt;/span&gt;,str);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i++]!=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\0&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;n++;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Reverse&amp;nbsp;of&amp;nbsp;%s&amp;nbsp;is&amp;nbsp;&quot;&lt;/span&gt;,str);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(i=n-&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;i&amp;gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;i--){&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;%c&quot;&lt;/span&gt;,&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;[i]);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;

In both program you get the same output:
&lt;br/&gt;
&lt;span style=&quot;background-color: #d0e0e3;&quot;&gt;dotcprograms.blogspot.in&lt;/span&gt;
  &lt;br/&gt;
&lt;span style=&quot;background-color: #d0e0e3;&quot;&gt;&lt;b&gt;Reverse of&lt;/b&gt; dotcprograms.blogspot.in &lt;b&gt;is&lt;/b&gt; ni.topsgolb.smargorpctod &lt;/span&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2017/10/how-to-reverse-string-in-c-without.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-7953417367627014663</guid><pubDate>Mon, 18 Sep 2017 14:13:00 +0000</pubDate><atom:updated>2017-09-18T19:43:46.764+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">dangling pointer</category><category domain="http://www.blogger.com/atom/ns#">interview questions</category><category domain="http://www.blogger.com/atom/ns#">null pointer</category><title>Dangling Pointer</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Dangling Pointer&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dangling pointer are the pointer which contain address of no &quot;&lt;u&gt;&lt;i&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;memory blocks&lt;/span&gt;&lt;/i&gt;&lt;/u&gt;.&quot;&lt;br /&gt;
In other words dangling pointer arises when the variable are address it is pointing to is freed.&lt;br /&gt;
or,&lt;br /&gt;
A pointer pointing to non-existing memory location is called dangling pointer.&lt;br /&gt;
Dangling pointer points to which is not valid anymore in the program.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to prevent dangling pointer generation:--&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;Allocate the pointer another object before deleting the object it is pointing currently.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;Don&#39;t delete the objects(not a good practice lead to memory blockage though)&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;&amp;nbsp;Example&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;main(){ &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int *p = malloc(sizeof(int));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; free (p);&amp;nbsp;&amp;nbsp; /* now the p becomes dangling pointer */&lt;br /&gt;&lt;br /&gt;}&lt;/b&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2017/09/dangling-pointer.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-6291062049075318619</guid><pubDate>Thu, 09 Apr 2015 08:36:00 +0000</pubDate><atom:updated>2020-12-16T14:00:37.260+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c program</category><category domain="http://www.blogger.com/atom/ns#">c questions</category><category domain="http://www.blogger.com/atom/ns#">dotcprograms</category><category domain="http://www.blogger.com/atom/ns#">magicsquarebox</category><title>Magic square in C</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: #222222; font-family: sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 22.28px; margin-bottom: 6.96px; margin-left: 0px; margin-right: 0px; margin-top: 6.96px; margin: 6.96px 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
A &lt;b style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;magic square&lt;/b&gt; is a &lt;span class=&quot;mwe-math-element&quot; style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;&lt;span class=&quot;mwe-math-mathml-inline mwe-math-mathml-a11y&quot; style=&quot;clip: rect(1px, 1px, 1px, 1px); display: block; font-size: 16.46px; height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px;&quot;&gt;&lt;math alttext=&quot;{\displaystyle n\times n}&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot; xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
  &lt;semantics style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
    &lt;mrow class=&quot;MJX-TeXAtom-ORD&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
      &lt;mstyle displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
        &lt;mi style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;n&lt;/mi&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;×&lt;/mo&gt;
        &lt;mi style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;n&lt;/mi&gt;
      &lt;/mstyle&gt;
    &lt;/mrow&gt;
    &lt;annotation encoding=&quot;application/x-tex&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;{\displaystyle n\times n}&lt;/annotation&gt;
  &lt;/semantics&gt;
&lt;/math&gt;&lt;/span&gt;&lt;img alt=&quot;n\times n&quot; aria-hidden=&quot;true&quot; class=&quot;mwe-math-fallback-image-inline&quot; src=&quot;https://wikimedia.org/api/rest_v1/media/math/render/svg/59d2b4cb72e304526cf5b5887147729ea259da78&quot; style=&quot;border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; border: 0px none rgb(34, 34, 34); display: inline-block; height: 12.02px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px; vertical-align: -2.37px; width: 40.53px;&quot; /&gt;&lt;/span&gt; square grid (where &lt;span class=&quot;mwe-math-element&quot; style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;&lt;span class=&quot;mwe-math-mathml-inline mwe-math-mathml-a11y&quot; style=&quot;clip: rect(1px, 1px, 1px, 1px); display: block; font-size: 16.46px; height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px;&quot;&gt;&lt;math alttext=&quot;{\displaystyle n}&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot; xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
  &lt;semantics style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
    &lt;mrow class=&quot;MJX-TeXAtom-ORD&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
      &lt;mstyle displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
        &lt;mi style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;n&lt;/mi&gt;
      &lt;/mstyle&gt;
    &lt;/mrow&gt;
    &lt;annotation encoding=&quot;application/x-tex&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;{\displaystyle n}&lt;/annotation&gt;
  &lt;/semantics&gt;
&lt;/math&gt;&lt;/span&gt;&lt;img alt=&quot;n&quot; aria-hidden=&quot;true&quot; class=&quot;mwe-math-fallback-image-inline&quot; src=&quot;https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b&quot; style=&quot;border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; border: 0px none rgb(34, 34, 34); display: inline-block; height: 12.02px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px; vertical-align: -2.37px; width: 10px;&quot; /&gt;&lt;/span&gt; is the number of cells on each side) filled with distinct positive integers in the range &lt;span class=&quot;mwe-math-element&quot; style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;&lt;span class=&quot;mwe-math-mathml-inline mwe-math-mathml-a11y&quot; style=&quot;clip: rect(1px, 1px, 1px, 1px); display: block; font-size: 16.46px; height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px;&quot;&gt;&lt;math alttext=&quot;{\displaystyle 1,2,...,n^{2}}&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot; xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
  &lt;semantics style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
    &lt;mrow class=&quot;MJX-TeXAtom-ORD&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
      &lt;mstyle displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
        &lt;mn style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;1&lt;/mn&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;,&lt;/mo&gt;
        &lt;mn style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;2&lt;/mn&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;,&lt;/mo&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;.&lt;/mo&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;.&lt;/mo&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;.&lt;/mo&gt;
        &lt;mo style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;,&lt;/mo&gt;
        &lt;msup style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
          &lt;mi style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;n&lt;/mi&gt;
          &lt;mrow class=&quot;MJX-TeXAtom-ORD&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
            &lt;mn style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;2&lt;/mn&gt;
          &lt;/mrow&gt;
        &lt;/msup&gt;
      &lt;/mstyle&gt;
    &lt;/mrow&gt;
    &lt;annotation encoding=&quot;application/x-tex&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;{\displaystyle 1,2,...,n^{2}}&lt;/annotation&gt;
  &lt;/semantics&gt;
&lt;/math&gt;&lt;/span&gt;&lt;img alt=&quot;{\displaystyle 1,2,...,n^{2}}&quot; aria-hidden=&quot;true&quot; class=&quot;mwe-math-fallback-image-inline&quot; src=&quot;https://wikimedia.org/api/rest_v1/media/math/render/svg/887eb3a03b3a8a0b8ba6b076593fdf802bbdf3ae&quot; style=&quot;border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; border: 0px none rgb(34, 34, 34); display: inline-block; height: 21.6px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px; vertical-align: -4.82px; width: 78.98px;&quot; /&gt;&lt;/span&gt; such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. The sum is called the &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;magic constant&lt;/i&gt; or &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;magic sum&lt;/i&gt; of the magic square. A square grid with &lt;span class=&quot;mwe-math-element&quot; style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;&lt;span class=&quot;mwe-math-mathml-inline mwe-math-mathml-a11y&quot; style=&quot;clip: rect(1px, 1px, 1px, 1px); display: block; font-size: 16.46px; height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px;&quot;&gt;&lt;math alttext=&quot;{\displaystyle n}&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot; xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
  &lt;semantics style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
    &lt;mrow class=&quot;MJX-TeXAtom-ORD&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
      &lt;mstyle displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;
        &lt;mi style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;n&lt;/mi&gt;
      &lt;/mstyle&gt;
    &lt;/mrow&gt;
    &lt;annotation encoding=&quot;application/x-tex&quot; style=&quot;clip: auto; display: inline; font-size: 16.46px; height: auto; opacity: 1; overflow: visible; position: static; width: auto;&quot;&gt;{\displaystyle n}&lt;/annotation&gt;
  &lt;/semantics&gt;
&lt;/math&gt;&lt;/span&gt;&lt;img alt=&quot;n&quot; aria-hidden=&quot;true&quot; class=&quot;mwe-math-fallback-image-inline&quot; src=&quot;https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b&quot; style=&quot;border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; border: 0px none rgb(34, 34, 34); display: inline-block; height: 12.02px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px; vertical-align: -2.37px; width: 10px;&quot; /&gt;&lt;/span&gt; cells on each side is said to have &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;order n&lt;/i&gt;.&lt;/div&gt;
&lt;span face=&quot;sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: #222222; direction: ltr; display: inline; float: none; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;/span&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: transparent; color: #222222; font-family: sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 22.28px; margin-bottom: 6.96px; margin-left: 0px; margin-right: 0px; margin-top: 6.96px; margin: 6.96px 0px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
The mathematical study of magic squares typically deals with its construction, classification, and enumeration. Although completely general methods for producing all the magic squares of all orders do not exist, historically three general techniques have been discovered: by bordering method, by making composite magic squares, and by adding two preliminary squares. There are also more specific strategies like the continuous enumeration method that reproduces specific patterns. The magic squares are generally classified according to their order &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;n&lt;/i&gt; as: odd if &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;n&lt;/i&gt; is odd, evenly even (also referred to as doubly even) if &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;n&lt;/i&gt; = 4&lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;k&lt;/i&gt; (e.g. 4, 8, 12, and so on), oddly even (also known as singly even) if &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;n&lt;/i&gt; = 4&lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;k&lt;/i&gt; + 2 (e.g. 6, 10, 14, and so on). This classification is based on different techniques required to construct odd, evenly even, and oddly even squares. Beside this, depending on further properties, magic squares are also classified as pan-diagonal magic squares and most-perfect magic square. More challengingly, attempts have also been made to classify all the magic squares of a given order as transformations of a smaller set of squares. Except for &lt;i style=&quot;line-height: 22.28px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin: 0px;&quot;&gt;n&lt;/i&gt; ≤ 5, the enumeration of higher order magic squares is still an open challenge. The enumeration of pan-diagonal magic squares of any order was only accomplished in the late 20th century.&lt;/div&gt;
&lt;b&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;u&gt;&lt;/u&gt;&lt;sub&gt;&lt;/sub&gt;&lt;sup&gt;&lt;/sup&gt;&lt;strike&gt;&lt;/strike&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;************************************Program**************************************&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;div style=&quot;background-color: #011627; color: #d6deeb; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c792ea;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; i,c,n,r;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt; We get the range of matrix in variable n and use&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;       to set the range for magic square box  &lt;/span&gt;&lt;span style=&quot;color: #637777;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ecc48d;&quot;&gt;Enter the range of magic square&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c5e478;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,&lt;span style=&quot;color: #7fdbca;&quot;&gt;&amp;amp;&lt;/span&gt;n);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea;&quot;&gt;int&lt;/span&gt; arr[n][n];&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;   In first for loop we use to arrange the elements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;         on the equations of magic square box     &lt;/span&gt;&lt;span style=&quot;color: #637777;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(i&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;;i&lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;=&lt;/span&gt;n&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;n;i&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        r&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;(n&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;i&lt;span style=&quot;color: #7fdbca;&quot;&gt;%&lt;/span&gt;n&lt;span style=&quot;color: #7fdbca;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #7fdbca;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #7fdbca;&quot;&gt;*&lt;/span&gt;((i&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;)&lt;span style=&quot;color: #7fdbca;&quot;&gt;/&lt;/span&gt;n))&lt;span style=&quot;color: #7fdbca;&quot;&gt;%&lt;/span&gt;n;    &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt; for row  //&lt;/span&gt;&lt;/div&gt;&lt;div&gt;        c&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;((n&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;)&lt;span style=&quot;color: #7fdbca;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #7fdbca;&quot;&gt;+&lt;/span&gt;i&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;(i&lt;span style=&quot;color: #7fdbca;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;1&lt;/span&gt;)&lt;span style=&quot;color: #7fdbca;&quot;&gt;/&lt;/span&gt;n)&lt;span style=&quot;color: #7fdbca;&quot;&gt;%&lt;/span&gt;n;   &lt;span style=&quot;color: #637777;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt; for column //&lt;/span&gt;&lt;/div&gt;&lt;div&gt;        arr[r][c]&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;i;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #637777;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;color: #637777; font-style: italic;&quot;&gt;    Here we print the generated magic square box using nested for loops   &lt;/span&gt;&lt;span style=&quot;color: #637777;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(r&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;r&lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt;n;r&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c792ea; font-style: italic;&quot;&gt;for&lt;/span&gt;(c&lt;span style=&quot;color: #c792ea;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;0&lt;/span&gt;;c&lt;span style=&quot;color: #c792ea;&quot;&gt;&amp;lt;&lt;/span&gt;n;c&lt;span style=&quot;color: #c792ea;&quot;&gt;++&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;,arr[r][c]);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #c5e478;&quot;&gt;printf&lt;/span&gt;(&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #f78c6c;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #d9f5dd;&quot;&gt;&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #82aaff; font-style: italic;&quot;&gt;getch&lt;/span&gt;&lt;span style=&quot;color: #82aaff;&quot;&gt;()&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;************************************Output***************************************&lt;/span&gt;&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout-key=&quot;-cu+3x+89-a0&quot; data-ad-slot=&quot;7127878345&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_2ozYutYlJgVcoo3pct-1HLawhtbT7aYK_OPBAX09WERWYKaxNIjC14tUCM8tUcLBEExsVcthYFMaqFbcmWi0DW2GmI9c_SwFZF1LFS2bzz1DcuhkFPDhEvubJljfJudRgla2EH66T1E/s1600/magicsquarebox.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_2ozYutYlJgVcoo3pct-1HLawhtbT7aYK_OPBAX09WERWYKaxNIjC14tUCM8tUcLBEExsVcthYFMaqFbcmWi0DW2GmI9c_SwFZF1LFS2bzz1DcuhkFPDhEvubJljfJudRgla2EH66T1E/s1600/magicsquarebox.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-7979004486439013&quot; data-ad-format=&quot;fluid&quot; data-ad-layout-key=&quot;-cu+3x+89-a0&quot; data-ad-slot=&quot;7127878345&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2015/04/c-program-for-magic-square-box.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_2ozYutYlJgVcoo3pct-1HLawhtbT7aYK_OPBAX09WERWYKaxNIjC14tUCM8tUcLBEExsVcthYFMaqFbcmWi0DW2GmI9c_SwFZF1LFS2bzz1DcuhkFPDhEvubJljfJudRgla2EH66T1E/s72-c/magicsquarebox.JPG" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-9212234502361509440</guid><pubDate>Wed, 01 Apr 2015 03:18:00 +0000</pubDate><atom:updated>2015-04-01T08:51:01.121+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">array in c</category><category domain="http://www.blogger.com/atom/ns#">c questions</category><category domain="http://www.blogger.com/atom/ns#">matrix questions in c</category><title>How to Merge Two matrix in C</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
By merging property in C we are able to merge(mix) two are more matrix in a single matrix one after one in a known sequence, for this we have to declare a array variable of size equal to the size of arrays variable that are to be merged&lt;br /&gt;
example: –int a[5]={1,2,3,4,5},b[5]={6,7,8,9,1};&lt;br /&gt;
&lt;blockquote&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int c[10];&lt;br /&gt;
that means if we want to merge matrix of array a[5] and matrix of array b[5] then we have to declare a matrix i.e. of size equal to 5+5 means a array of size 10, so here c[10]. Now come to the example:-&lt;/blockquote&gt;
&lt;br /&gt;
&lt;blockquote&gt;
 &lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;******************************Program*********************************&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; arr1&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;arr2&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; arr3&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;k&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;1st matrix:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;arr1&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;2nd matrix:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;arr2&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            arr3&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;arr2&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;k&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
            k&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;k&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
            arr3&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;arr1&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    i&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Matrix after merging:&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;arr3&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;*************************************Output*****************************&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://lh5.ggpht.com/-C7asgxCwWMc/VRtjatoz8JI/AAAAAAAAFSA/K7CymdWGzsk/s1600-h/matrixmerginginc%25255B22%25255D.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;matrixmerginginc&quot; border=&quot;0&quot; src=&quot;http://lh5.ggpht.com/-UvUh9pVJeS8/VRtjbst_PwI/AAAAAAAAFSI/45Dq_G31GyY/matrixmerginginc_thumb%25255B18%25255D.jpg?imgmax=800&quot; height=&quot;329&quot; style=&quot;background-image: none; border: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;matrixmerginginc&quot; width=&quot;644&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Output of matrix merging&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9ca71f7e-4b73-43a6-88f4-9bee29322889&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
Technorati Tags: &lt;a href=&quot;http://technorati.com/tags/C+questions&quot; rel=&quot;tag&quot;&gt;C questions&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/array+in+c&quot; rel=&quot;tag&quot;&gt;array in c&lt;/a&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2015/04/how-to-merge-two-matrix-in-c.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-UvUh9pVJeS8/VRtjbst_PwI/AAAAAAAAFSI/45Dq_G31GyY/s72-c/matrixmerginginc_thumb%25255B18%25255D.jpg?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-1365082357413140025</guid><pubDate>Thu, 19 Mar 2015 15:08:00 +0000</pubDate><atom:updated>2015-03-19T20:38:48.360+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c questions</category><title>C program for calculating Geometric Progression (GP)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
In&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Mathematics&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Mathematics&quot;&gt;mathematics&lt;/a&gt;, a&amp;nbsp;&lt;b&gt;geometric progression&lt;/b&gt;, also known as a&amp;nbsp;&lt;b&gt;geometric sequence&lt;/b&gt;, is a&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Sequence&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Sequence&quot;&gt;sequence&lt;/a&gt;&amp;nbsp;of&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Number&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Number&quot;&gt;numbers&lt;/a&gt;&amp;nbsp;where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the&amp;nbsp;&lt;i&gt;common ratio&lt;/i&gt;. For example, the sequence 2, 6, 18, 54, ... is a geometric progression with common ratio 3. Similarly 10, 5, 2.5, 1.25, ... is a geometric sequence with common ratio 1/2.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
Examples of a geometric sequence are&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Exponentiation&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Exponentiation&quot;&gt;powers&lt;/a&gt;&amp;nbsp;&lt;i&gt;r&lt;/i&gt;&lt;sup style=&quot;font-size: 11.1999998092651px; line-height: 1;&quot;&gt;&lt;i&gt;k&lt;/i&gt;&lt;/sup&gt;&amp;nbsp;of a fixed number&amp;nbsp;&lt;i&gt;r&lt;/i&gt;, such as&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Power_of_two&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Power of two&quot;&gt;2&lt;sup style=&quot;font-size: 11.1999998092651px; line-height: 1;&quot;&gt;&lt;i&gt;k&lt;/i&gt;&lt;/sup&gt;&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a class=&quot;mw-redirect&quot; href=&quot;http://en.wikipedia.org/wiki/Power_of_three&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Power of three&quot;&gt;3&lt;sup style=&quot;font-size: 11.1999998092651px; line-height: 1;&quot;&gt;&lt;i&gt;k&lt;/i&gt;&lt;/sup&gt;&lt;/a&gt;. The general form of a geometric sequence is&lt;/div&gt;
&lt;dl style=&quot;background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.2em;&quot;&gt;&lt;dd style=&quot;line-height: 1.6; margin-bottom: 0.1em; margin-left: 1.6em; margin-right: 0px;&quot;&gt;&lt;img alt=&quot;a,\ ar,\ ar^2,\ ar^3,\ ar^4,\ \ldots&quot; class=&quot;mwe-math-fallback-image-inline tex&quot; src=&quot;http://upload.wikimedia.org/math/1/5/b/15b1e5bc8f8e8c5e7d46fd177eb625d6.png&quot; style=&quot;border: none; display: inline-block; vertical-align: middle;&quot; /&gt;&lt;/dd&gt;&lt;/dl&gt;
&lt;div style=&quot;background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
where&amp;nbsp;&lt;i&gt;r&lt;/i&gt;&amp;nbsp;≠ 0 is the common ratio and&amp;nbsp;&lt;i&gt;a&lt;/i&gt;&amp;nbsp;is a&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_factor&quot; style=&quot;background: none; color: #0b0080; text-decoration: none;&quot; title=&quot;Scale factor&quot;&gt;scale factor&lt;/a&gt;, equal to the sequence&#39;s start value.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;************************************************************Program***********************************************************&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; a&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;r&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the first term of your GP : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;a&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the ratio(r) : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;r&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the number of terms you want to get in your GP : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;GP of your given data is :&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;a&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        t&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;a&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;r&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        a&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;t&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        n&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;************************************************************Output**************************************************************&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJRb7SNmw6Akf9oNQzzEg_0T7_aelSIORy2B_P5n1itrvS264XZsPS3KEWNXJCWd0rCOUXE5fREiZGLsn5-lSWYq8qZvmplgLjOztSRMGkwt9c4Hxhlzo22hy0EOppa_dLQmNwJd7zwek/s1600/GPincprogram.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJRb7SNmw6Akf9oNQzzEg_0T7_aelSIORy2B_P5n1itrvS264XZsPS3KEWNXJCWd0rCOUXE5fREiZGLsn5-lSWYq8qZvmplgLjOztSRMGkwt9c4Hxhlzo22hy0EOppa_dLQmNwJd7zwek/s1600/GPincprogram.JPG&quot; height=&quot;322&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Output for GP in C&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; font-family: sans-serif; font-size: 14px; line-height: 22.3999996185303px; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2015/03/c-program-for-calculating-geometric.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJRb7SNmw6Akf9oNQzzEg_0T7_aelSIORy2B_P5n1itrvS264XZsPS3KEWNXJCWd0rCOUXE5fREiZGLsn5-lSWYq8qZvmplgLjOztSRMGkwt9c4Hxhlzo22hy0EOppa_dLQmNwJd7zwek/s72-c/GPincprogram.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8712552229034289053.post-1155056344785536491</guid><pubDate>Wed, 18 Mar 2015 16:38:00 +0000</pubDate><atom:updated>2015-03-18T22:08:57.488+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">c questions</category><title>C program for Arithmetic Progression calculation</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;ol data-ved=&quot;0CB4Q_xc&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: arial, sans-serif; font-size: 13px; line-height: 15.6000003814697px; margin: 0px; padding: 0px;&quot;&gt;
&lt;li class=&quot;mod&quot; data-md=&quot;61&quot; style=&quot;border: 0px; clear: none; line-height: 1.24; list-style: none; margin: 0px; padding: 20px 20px 0px;&quot;&gt;&lt;div class=&quot;_oDd&quot; data-hveid=&quot;38&quot; style=&quot;overflow: hidden; padding-bottom: 20px;&quot;&gt;
&lt;span class=&quot;_Tgc&quot; style=&quot;font-size: 16px;&quot;&gt;An&amp;nbsp;&lt;b&gt;arithmetic progression&lt;/b&gt;&amp;nbsp;is a sequence of numbers such that the difference of any two successive members of the sequence is a constant. For example, the sequence 1, 2, 3, 4, ... is is an&amp;nbsp;&lt;b&gt;arithmetic progression&lt;/b&gt;&amp;nbsp;with common difference 1.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;***************************************Program***********************************&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;pre&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;stdio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #004a43;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #40015a;&quot;&gt;conio.h&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #400000;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; a&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;d&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the first term of your AP : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;a&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the difference b/w terms : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;d&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;Enter the number of terms you want to get in your AP : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;scanf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;&amp;amp;&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;AP of your given data is :&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;a&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;n&lt;span style=&quot;color: #808030;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        t&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;a&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;d&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #603000;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0f69ff;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        a&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;t&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        n&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
    getch&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;***************************************Output************************************&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDXTrQpaRQch2dPAn0oUPV7elbxSft_Ax8JqYBsHqZrqtwSE4yznM-KMu6NVLN5-wfOxCpicgeFLg2ullQVKzevwezPnXHwW3eXMur85CZ35qnixLGEYeUbGG-LKVkafP8eeExB3j0NQU/s1600/APincprogram.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDXTrQpaRQch2dPAn0oUPV7elbxSft_Ax8JqYBsHqZrqtwSE4yznM-KMu6NVLN5-wfOxCpicgeFLg2ullQVKzevwezPnXHwW3eXMur85CZ35qnixLGEYeUbGG-LKVkafP8eeExB3j0NQU/s1600/APincprogram.JPG&quot; height=&quot;322&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Output of AP program in C&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://dotcprograms.blogspot.com/2015/03/c-program-for-arithmetic-progression.html</link><author>noreply@blogger.com (Aditya Narayan Singh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDXTrQpaRQch2dPAn0oUPV7elbxSft_Ax8JqYBsHqZrqtwSE4yznM-KMu6NVLN5-wfOxCpicgeFLg2ullQVKzevwezPnXHwW3eXMur85CZ35qnixLGEYeUbGG-LKVkafP8eeExB3j0NQU/s72-c/APincprogram.JPG" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>