<?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-5366762931879462197</atom:id><lastBuildDate>Sat, 05 Oct 2024 02:10:40 +0000</lastBuildDate><category>C Plus Plus</category><category>C++</category><category>array</category><category>Factorial</category><category>Fibonacci</category><category>search</category><category>sort</category><category>C</category><category>math</category><category>Java</category><category>Linked List</category><category>Python</category><category>list</category><category>2d array</category><category>number</category><title>ProgrmIt</title><description>A blog to help students to learn programming in various languages including C, C++, Java, Python and many more.</description><link>http://progrmitx.blogspot.com/</link><managingEditor>noreply@blogger.com (Anonymous)</managingEditor><generator>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7159630235284390342</guid><pubDate>Sun, 10 Jul 2016 09:56:00 +0000</pubDate><atom:updated>2016-07-13T11:12:03.938-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Fibonacci</category><category domain="http://www.blogger.com/atom/ns#">Python</category><title>Write a program to find Fibonacci series of n numbers in Python.</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: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&amp;nbsp;In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
01, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.....&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
The Fibonacci spiral: an approximation of the golden spiral created by drawing circular arcs connecting the opposite corners of squares in the Fibonacci tiling; this one uses squares of sizes 1, 1, 2, 3, 5, 8, 13, 21, and 34.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; rel=&quot;nofollow&quot; style=&quot;color: #2361a1; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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/AVvXsEgQJvCU5kvCqg84TtLepgIg35_fcY73zrDNaHdCJW47yIoaPNqEnUZlTUB2Mw1nD3y4SP_lP_WLTkqN-eRZRcCPXW0pCxl6oJpdws7NLpP5UPlNbV8sVluV_IEE8Ik6cOf0Y-KhjOUo4eI/s1600/seFibo_py.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;181&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQJvCU5kvCqg84TtLepgIg35_fcY73zrDNaHdCJW47yIoaPNqEnUZlTUB2Mw1nD3y4SP_lP_WLTkqN-eRZRcCPXW0pCxl6oJpdws7NLpP5UPlNbV8sVluV_IEE8Ik6cOf0Y-KhjOUo4eI/s400/seFibo_py.JPG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
def fibo( x ):&lt;br /&gt;
&amp;nbsp; &amp;nbsp; f = -1; s = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for i in range(0,x):&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = f + s&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; f = s&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s = n&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print n&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return;&lt;br /&gt;
n = input (&quot;Enter the total elements in the series: &quot;)&lt;br /&gt;
print &quot;The Fibonacci series is: &quot;&lt;br /&gt;
fibo(n)&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/07/write-program-to-find-fibonacci-series_10.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQJvCU5kvCqg84TtLepgIg35_fcY73zrDNaHdCJW47yIoaPNqEnUZlTUB2Mw1nD3y4SP_lP_WLTkqN-eRZRcCPXW0pCxl6oJpdws7NLpP5UPlNbV8sVluV_IEE8Ik6cOf0Y-KhjOUo4eI/s72-c/seFibo_py.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-8502534652109732382</guid><pubDate>Sat, 09 Jul 2016 21:47:00 +0000</pubDate><atom:updated>2016-07-11T13:20:00.343-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Fibonacci</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Write a program to find Fibonacci series of n numbers in Java.</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: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&amp;nbsp;&amp;nbsp;In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
01, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.....&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
The Fibonacci spiral: an approximation of the golden spiral created by drawing circular arcs connecting the opposite corners of squares in the Fibonacci tiling; this one uses squares of sizes 1, 1, 2, 3, 5, 8, 13, 21, and 34.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; rel=&quot;nofollow&quot; style=&quot;color: #2361a1; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&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/AVvXsEjZns7deC9pUlZ7l8mGkl_60fl1PQsEqZM9hIjptxSZ8U5sxBZnnZhQHlPQ6YFB1p_LsWcGi8qW7cKK5GyAQdNJcM4c2MxcZHDnDqI2OkPxl4rWqwKIVlEHdP6CK6A3QpsIEN7OauML_eE/s1600/seFibo.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;130&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZns7deC9pUlZ7l8mGkl_60fl1PQsEqZM9hIjptxSZ8U5sxBZnnZhQHlPQ6YFB1p_LsWcGi8qW7cKK5GyAQdNJcM4c2MxcZHDnDqI2OkPxl4rWqwKIVlEHdP6CK6A3QpsIEN7OauML_eE/s400/seFibo.JPG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;color: #333333;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;import java.util.Scanner;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;public class seFibo {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; public static int fibo(int x) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int f = -1, s = 1, n;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; x; ++i) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = f + s;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; f = s;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s = n;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println( n );&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return (0);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void main(String[] args) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n, i;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Scanner sc = new Scanner (System.in);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.print(&quot;Enter the total elements in the series: &quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = sc.nextInt();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;The Fibonacci series is: &quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fibo(n);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;div style=&quot;color: #333333;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Note: The program must be saved with name &quot;SeFibo.java&quot;.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/07/write-program-to-find-fibonacci-series.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZns7deC9pUlZ7l8mGkl_60fl1PQsEqZM9hIjptxSZ8U5sxBZnnZhQHlPQ6YFB1p_LsWcGi8qW7cKK5GyAQdNJcM4c2MxcZHDnDqI2OkPxl4rWqwKIVlEHdP6CK6A3QpsIEN7OauML_eE/s72-c/seFibo.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-2314563494149888643</guid><pubDate>Fri, 08 Jul 2016 18:35:00 +0000</pubDate><atom:updated>2016-07-08T11:35:07.525-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Factorial</category><category domain="http://www.blogger.com/atom/ns#">Python</category><title>Write a program to find factorial of a number in Python.</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: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
5! = 5 &amp;nbsp;* &amp;nbsp;4 &amp;nbsp;* &amp;nbsp;3 &amp;nbsp;* &amp;nbsp;2 &amp;nbsp;* 1 = 120.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
The value of 0! is 1, according to the convention for an empty product.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic occurrence is the fact that there are n! ways to arrange n distinct objects into a sequence (i.e., permutations of the set of objects). This fact was known at least as early as the 12th century, to Indian scholars. Fabian Stedman in 1677 described factorials as applied to change ringing.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;div style=&quot;color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Factorial&quot; rel=&quot;nofollow&quot; style=&quot;color: #2361a1; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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;color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; 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/AVvXsEhBmyNWfYH02IJhLRT78LO7qbQP0EhlydxI6ZuQYiZra-HToM6TW_kjD8keqH3CEm7jKD-I4pX-CYSZ6nluT4d7hTmYRQN2Zp9J7lay2rhB3WZFYhxEP22C7i4bpKpO82CuiCjsC5gPD9M/s1600/seFact_py.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBmyNWfYH02IJhLRT78LO7qbQP0EhlydxI6ZuQYiZra-HToM6TW_kjD8keqH3CEm7jKD-I4pX-CYSZ6nluT4d7hTmYRQN2Zp9J7lay2rhB3WZFYhxEP22C7i4bpKpO82CuiCjsC5gPD9M/s400/seFact_py.JPG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;f = 1&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;x = input(&quot;Enter a number: &quot;)&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;for i in range(1,x+1):&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; f = f * i&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;print &quot;Factorial: %d&quot; % f&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/07/write-program-to-find-factorial-of_8.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBmyNWfYH02IJhLRT78LO7qbQP0EhlydxI6ZuQYiZra-HToM6TW_kjD8keqH3CEm7jKD-I4pX-CYSZ6nluT4d7hTmYRQN2Zp9J7lay2rhB3WZFYhxEP22C7i4bpKpO82CuiCjsC5gPD9M/s72-c/seFact_py.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-2553375908050332383</guid><pubDate>Fri, 08 Jul 2016 11:02:00 +0000</pubDate><atom:updated>2016-07-08T04:02:15.672-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Factorial</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Write a program to find factorial of a number in Java.</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: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&amp;nbsp;&amp;nbsp;In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
5! = 5 &amp;nbsp;* &amp;nbsp;4 &amp;nbsp;* &amp;nbsp;3 &amp;nbsp;* &amp;nbsp;2 &amp;nbsp;* 1 = 120.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
The value of 0! is 1, according to the convention for an empty product.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic occurrence is the fact that there are n! ways to arrange n distinct objects into a sequence (i.e., permutations of the set of objects). This fact was known at least as early as the 12th century, to Indian scholars. Fabian Stedman in 1677 described factorials as applied to change ringing.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Factorial&quot; rel=&quot;nofollow&quot; style=&quot;color: #2361a1; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 22.5px; 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/AVvXsEh89fe90g1ZShaWP3pzuqgedYd8QLRSZLLLh7zVxnTzMDuTe66DLufDAcVMpCXFbs4RyTqx7IrPGAr4KLiRACfdMP1HpAK5itaiwzH9mGESfXLTLz5oj90z9TAKkr20LYNZKg4xNgbRm6o/s1600/seFact.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;141&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh89fe90g1ZShaWP3pzuqgedYd8QLRSZLLLh7zVxnTzMDuTe66DLufDAcVMpCXFbs4RyTqx7IrPGAr4KLiRACfdMP1HpAK5itaiwzH9mGESfXLTLz5oj90z9TAKkr20LYNZKg4xNgbRm6o/s400/seFact.JPG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;import java.util.Scanner;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;public class SeFact {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void main(String[] args) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int x, f = 1;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.print(&quot;Enter a number: &quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Scanner sc = new Scanner(System.in);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x = sc.nextInt();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 1; i &amp;lt;= x; ++i) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; f = f * i;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;Factorial: &quot; + f);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Note: The program must be saved with name &quot;SeFact.java&quot;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/07/write-program-to-find-factorial-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh89fe90g1ZShaWP3pzuqgedYd8QLRSZLLLh7zVxnTzMDuTe66DLufDAcVMpCXFbs4RyTqx7IrPGAr4KLiRACfdMP1HpAK5itaiwzH9mGESfXLTLz5oj90z9TAKkr20LYNZKg4xNgbRm6o/s72-c/seFact.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-8353279737003515328</guid><pubDate>Sat, 19 Mar 2016 19:45:00 +0000</pubDate><atom:updated>2016-03-19T12:45:17.320-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C</category><category domain="http://www.blogger.com/atom/ns#">search</category><title>Write a program to search a value from an array in C.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;In computer science, a search allows the efficient retrieval of specific items from a set of items, such as a specific record from a database.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The simplest, most general, and least efficient search structure is merely an unordered sequential list of all the items. Locating the desired item in such a list, by the linear search method, inevitably requires a number of operations proportional to the number n of items, in the worst case as well as in the average case. Useful search data structures allow faster retrieval; however, they are limited to queries of some specific kind. Moreover, since the cost of building such structures is at least proportional to n, they only pay off if several queries are to be performed on the same database (or on a database that changes little between queries).&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Search_data_structure&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&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/AVvXsEg_Ol4PQGJZeb9p7xYXr9eqfdutAF9-afAd66CxMN-YZeRFuaDtgk7E6LwnK2IG2CuHufkPJcZYPJ_D16dR32F601Yr54FVjQV583N1Zub260IRlY_-R_ZQ8GWUDMIZFdVaxr86mpqRBsw/s1600/search.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;84&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Ol4PQGJZeb9p7xYXr9eqfdutAF9-afAd66CxMN-YZeRFuaDtgk7E6LwnK2IG2CuHufkPJcZYPJ_D16dR32F601Yr54FVjQV583N1Zub260IRlY_-R_ZQ8GWUDMIZFdVaxr86mpqRBsw/s320/search.PNG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;conio.h&amp;gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int loc, n, data, x, a[100];&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;Enter no. of values: &quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;scanf(&quot;%d&quot;, &amp;amp;n);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;Enter %d values: &quot;, n);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(x=0; x&amp;lt;n; x++) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;scanf(&quot;%d&quot;, &amp;amp;a[x]);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;Entered array is: \n&quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(x=0; x&amp;lt;n; x++) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;printf(&quot;%d &amp;nbsp;&quot;, a[x]);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;\nEnter data to search: &quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;scanf(&quot;%d&quot;, &amp;amp;data);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(x=0; x&amp;lt;n; x++) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(data==a[x]) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;printf(&quot;Location is: %d\n&quot;, x);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;loc=x;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;break;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;loc=x;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(data!=a[loc]) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;printf(&quot;Element not found\n&quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;}&lt;/blockquote&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/03/write-program-to-search-value-from.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Ol4PQGJZeb9p7xYXr9eqfdutAF9-afAd66CxMN-YZeRFuaDtgk7E6LwnK2IG2CuHufkPJcZYPJ_D16dR32F601Yr54FVjQV583N1Zub260IRlY_-R_ZQ8GWUDMIZFdVaxr86mpqRBsw/s72-c/search.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-9150087171847552022</guid><pubDate>Sat, 19 Mar 2016 19:26:00 +0000</pubDate><atom:updated>2016-03-19T12:26:45.031-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C</category><category domain="http://www.blogger.com/atom/ns#">Factorial</category><title>Write a program to find factorial of a number in C.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,&lt;br /&gt;
&lt;br /&gt;
5! = 5 &amp;nbsp;* &amp;nbsp;4 &amp;nbsp;* &amp;nbsp;3 &amp;nbsp;* &amp;nbsp;2 &amp;nbsp;* 1 = 120.&lt;br /&gt;
The value of 0! is 1, according to the convention for an empty product.&lt;br /&gt;
&lt;br /&gt;
The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic occurrence is the fact that there are n! ways to arrange n distinct objects into a sequence (i.e., permutations of the set of objects). This fact was known at least as early as the 12th century, to Indian scholars. Fabian Stedman in 1677 described factorials as applied to change ringing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Factorial&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&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/AVvXsEgWm4a3vY9TsLwmVTeL6qnvX9tr06hbkSylHHBAc4og7xtDZ1Clst2df7ZrypGZYDCsKpSawseUiwV91CsV95OXF1nPZ1L8LP9ZRut0BDkoK9x6VQDzO-RdH_hqg2xsCT4nk5gYVw_y6hY/s1600/seFact.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;76&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWm4a3vY9TsLwmVTeL6qnvX9tr06hbkSylHHBAc4og7xtDZ1Clst2df7ZrypGZYDCsKpSawseUiwV91CsV95OXF1nPZ1L8LP9ZRut0BDkoK9x6VQDzO-RdH_hqg2xsCT4nk5gYVw_y6hY/s400/seFact.PNG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;conio.h&amp;gt;&lt;br /&gt;int main() {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int x,f=1,i;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;Enter a number: &quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;scanf(&quot;%d&quot;, &amp;amp;x);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for (i = 1; i &amp;lt;= x; ++i)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f=f*i;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;Factorial: %d\n&quot;,f);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;}&lt;/blockquote&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/03/write-program-to-find-factorial-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWm4a3vY9TsLwmVTeL6qnvX9tr06hbkSylHHBAc4og7xtDZ1Clst2df7ZrypGZYDCsKpSawseUiwV91CsV95OXF1nPZ1L8LP9ZRut0BDkoK9x6VQDzO-RdH_hqg2xsCT4nk5gYVw_y6hY/s72-c/seFact.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-2713146330813664275</guid><pubDate>Sat, 19 Mar 2016 19:17:00 +0000</pubDate><atom:updated>2016-03-19T12:17:09.021-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C</category><category domain="http://www.blogger.com/atom/ns#">Fibonacci</category><title>Write a program to find Fibonacci series of n numbers in C.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
01, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.....&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The Fibonacci spiral: an approximation of the golden spiral created by drawing circular arcs connecting the opposite corners of squares in the Fibonacci tiling; this one uses squares of sizes 1, 1, 2, 3, 5, 8, 13, 21, and 34.&lt;/div&gt;
&lt;div&gt;
By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&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/AVvXsEgN0auodyqkJyT7K7Wv9RvK1r8zK0El6sdNXyxzeaqoS7siLkdFPpBw2uNxpPdBBCXeZA4XXSHnqtvwz8wW2q2HXoz3rJEkEg7yJ6V9FqMHswBQ8zVZ0ddy4cbehtAosayFAapDSOQSo60/s1600/seFibo.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN0auodyqkJyT7K7Wv9RvK1r8zK0El6sdNXyxzeaqoS7siLkdFPpBw2uNxpPdBBCXeZA4XXSHnqtvwz8wW2q2HXoz3rJEkEg7yJ6V9FqMHswBQ8zVZ0ddy4cbehtAosayFAapDSOQSo60/s400/seFibo.PNG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;conio.h&amp;gt;&lt;br /&gt;int fibo(int);&lt;br /&gt;int main() {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;Enter the total elements in the series: &quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;scanf(&quot;%d&quot;, &amp;amp;n);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;printf(&quot;The Fibonacci series is: \n&quot;);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fibo(n);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;}&lt;br /&gt;int fibo(int x) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int f=-1,s=1,n, i;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for (i = 0; i &amp;lt; x; i++)&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;n=f+s;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f=s;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;s=n;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;printf(&quot;%d\n&quot;, n);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;}&lt;/blockquote&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/03/write-program-to-find-fibonacci-series.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN0auodyqkJyT7K7Wv9RvK1r8zK0El6sdNXyxzeaqoS7siLkdFPpBw2uNxpPdBBCXeZA4XXSHnqtvwz8wW2q2HXoz3rJEkEg7yJ6V9FqMHswBQ8zVZ0ddy4cbehtAosayFAapDSOQSo60/s72-c/seFibo.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7861803163177632490</guid><pubDate>Thu, 18 Feb 2016 20:07:00 +0000</pubDate><atom:updated>2016-03-24T11:56:47.234-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">search</category><title>Write a program to delete an element from an array.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEgKadkIz-R-osMyQCJ5uXNkVpYhPHUHxWhQIq-ClVLgHUAZ1upMdQk8M9ZI7F6AS3sgnkIUTD9-QdxBOcz1g-lhfKeUxvgC093zD2OSJBhjSqEdZbuJbwAZ0f0jLhCCqmzOOio3Abk4oBE/s1600/deletion.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;ScreenShot&quot; border=&quot;0&quot; height=&quot;120&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKadkIz-R-osMyQCJ5uXNkVpYhPHUHxWhQIq-ClVLgHUAZ1upMdQk8M9ZI7F6AS3sgnkIUTD9-QdxBOcz1g-lhfKeUxvgC093zD2OSJBhjSqEdZbuJbwAZ0f0jLhCCqmzOOio3Abk4oBE/s400/deletion.PNG&quot; title=&quot;ScreenShot&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;&lt;span style=&quot;font-size: 12.8px;&quot;&gt;Output&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int search(int *a,int x,int n);&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int loc,n,data,a[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Entered array is: &quot;&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;a[x]&amp;lt;&amp;lt;&quot; &amp;nbsp;&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nEnter element you want to delete: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;data;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;loc=search(&amp;amp;a[0],data,n);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if ( loc== -1 )&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Entered element is not present in array.&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int x=loc;x&amp;lt;n-1;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[x]=a[x+1];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Array after deletion:&quot;&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int x=0;x&amp;lt;n-1;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;cout&amp;lt;&amp;lt;a[x]&amp;lt;&amp;lt;&quot; &amp;nbsp;&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int search(int *a,int data,int n)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(data==a[x]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return(x);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(-1);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/02/write-program-to-delete-element-from.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKadkIz-R-osMyQCJ5uXNkVpYhPHUHxWhQIq-ClVLgHUAZ1upMdQk8M9ZI7F6AS3sgnkIUTD9-QdxBOcz1g-lhfKeUxvgC093zD2OSJBhjSqEdZbuJbwAZ0f0jLhCCqmzOOio3Abk4oBE/s72-c/deletion.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7627444935161928402</guid><pubDate>Sun, 24 Jan 2016 20:09:00 +0000</pubDate><atom:updated>2016-03-24T11:57:16.428-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">Fibonacci</category><title>Write a program to find Fibonacci series of n numbers in C++.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
01, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.....&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The Fibonacci spiral: an approximation of the golden spiral created by drawing circular arcs connecting the opposite corners of squares in the Fibonacci tiling; this one uses squares of sizes 1, 1, 2, 3, 5, 8, 13, 21, and 34.&lt;/div&gt;
&lt;div&gt;
By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&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/AVvXsEj8ZgKDCX3r8XF5l1Rx-FU2oNKsgVBKtVE_N7LCwGKBqUoZXgygnkDkM-dfgFz0A9s2tt3SSzD5P3IjWjUmbc8n8B0KJ3rZq_w49rnkesUKIoOOSlXdDuW8Vbyp0udWv6kQ0NjW0fFl_Z8/s1600/seFibo.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8ZgKDCX3r8XF5l1Rx-FU2oNKsgVBKtVE_N7LCwGKBqUoZXgygnkDkM-dfgFz0A9s2tt3SSzD5P3IjWjUmbc8n8B0KJ3rZq_w49rnkesUKIoOOSlXdDuW8Vbyp0udWv6kQ0NjW0fFl_Z8/s400/seFibo.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int fibo(int);&lt;br /&gt;
int main() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n,i;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter the total elements in the series: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;The Fibonacci series is: \n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;fibo(n);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;br /&gt;
int fibo(int x) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int f=-1,s=1,n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for (int i = 0; i &amp;lt; x; ++i)&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;n=f+s;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f=s;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;s=n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;/blockquote&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-find-fibonacci-series.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8ZgKDCX3r8XF5l1Rx-FU2oNKsgVBKtVE_N7LCwGKBqUoZXgygnkDkM-dfgFz0A9s2tt3SSzD5P3IjWjUmbc8n8B0KJ3rZq_w49rnkesUKIoOOSlXdDuW8Vbyp0udWv6kQ0NjW0fFl_Z8/s72-c/seFibo.PNG" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7614239559685942810</guid><pubDate>Sun, 24 Jan 2016 20:05:00 +0000</pubDate><atom:updated>2016-07-07T14:19:29.717-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">Factorial</category><title>Write a program to find factorial of a number in C++.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
5! = 5 &amp;nbsp;* &amp;nbsp;4 &amp;nbsp;* &amp;nbsp;3 &amp;nbsp;* &amp;nbsp;2 &amp;nbsp;* 1 = 120.&lt;/div&gt;
&lt;div&gt;
The value of 0! is 1, according to the convention for an empty product.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic occurrence is the fact that there are n! ways to arrange n distinct objects into a sequence (i.e., permutations of the set of objects). This fact was known at least as early as the 12th century, to Indian scholars. Fabian Stedman in 1677 described factorials as applied to change ringing.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Factorial&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&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/AVvXsEjjv-hrF4Os_04fdaSeSyXPTA0diyExe501zEcBoOaYY8E9_pMYIAwjD_e2LDAfQPBYqPXsuMiOGiSi6b7CcdieGbm_coxWVYowOQKAlqKiJPVgt7PHCYaD5716va3EsrO0Axfrc7LRfd4/s1600/seFact.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;76&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjv-hrF4Os_04fdaSeSyXPTA0diyExe501zEcBoOaYY8E9_pMYIAwjD_e2LDAfQPBYqPXsuMiOGiSi6b7CcdieGbm_coxWVYowOQKAlqKiJPVgt7PHCYaD5716va3EsrO0Axfrc7LRfd4/s400/seFact.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;using namespace std;&lt;br /&gt;int main() {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int x,f=1;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter a number: &quot;;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;x;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for (int i = 1; i &amp;lt;= x; ++i)&amp;nbsp;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;f=f*i;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Factorial: &quot;&amp;lt;&amp;lt;f&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;}&lt;/blockquote&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-find-factorial-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjv-hrF4Os_04fdaSeSyXPTA0diyExe501zEcBoOaYY8E9_pMYIAwjD_e2LDAfQPBYqPXsuMiOGiSi6b7CcdieGbm_coxWVYowOQKAlqKiJPVgt7PHCYaD5716va3EsrO0Axfrc7LRfd4/s72-c/seFact.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-5968970278782227444</guid><pubDate>Sun, 24 Jan 2016 20:02:00 +0000</pubDate><atom:updated>2016-03-24T11:59:25.316-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">Linked List</category><category domain="http://www.blogger.com/atom/ns#">list</category><title>Write a program to insert info\elements in the Linked List.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEhupCWIcCQoKPXYqB-gwDZDsanLSngpb55LoAUHz4YMkYghexottumuIkt0PE8T4BNtgJG9oih2afIBL6B6mg4bSua9RZwbEQx2wreLv2Er1DxnQelnA3rT_8ljNAYzqRXrwssXdW6Ysfs/s1600/LinkedListInsertion.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;357&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhupCWIcCQoKPXYqB-gwDZDsanLSngpb55LoAUHz4YMkYghexottumuIkt0PE8T4BNtgJG9oih2afIBL6B6mg4bSua9RZwbEQx2wreLv2Er1DxnQelnA3rT_8ljNAYzqRXrwssXdW6Ysfs/s400/LinkedListInsertion.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
struct node {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int info;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node* link;&lt;br /&gt;
}*start,*nNode;&lt;br /&gt;
node * createNew() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;nNode = new node;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter info for node: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;nNode-&amp;gt;info;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return (nNode);&lt;br /&gt;
}&lt;br /&gt;
node display(node* temp) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;while(temp!=NULL) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;temp-&amp;gt;info&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;temp=temp-&amp;gt;link;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
int main() {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n=2,s,af;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;start=NULL;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node* tempPtr;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Press 1 to enter new node: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;while(n==1) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Where you want to insert node: \n1- In begining\t\t2- In between\t\t3- At end\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;s;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;switch(s) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;case 1:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if(start==NULL) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;start=createNew();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;start-&amp;gt;link=NULL;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;nNode=createNew();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;nNode-&amp;gt;link=start;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;start=nNode;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;break;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;case 2:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nInfo in linked list: \n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;display(start);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;After which info you want new element: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cin&amp;gt;&amp;gt;af;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;tempPtr=start;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;while(tempPtr!=NULL &amp;amp;&amp;amp; tempPtr-&amp;gt;info!=af) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;tempPtr=tempPtr-&amp;gt;link;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;if (tempPtr==NULL) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Entered info not found.\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;nNode=createNew();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;nNode-&amp;gt;link=tempPtr-&amp;gt;link;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;tempPtr-&amp;gt;link=nNode;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;break;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;case 3:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;tempPtr=start;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;while(tempPtr-&amp;gt;link!=NULL &amp;amp;&amp;amp; tempPtr!=NULL) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;tempPtr=tempPtr-&amp;gt;link;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;nNode=createNew();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;tempPtr-&amp;gt;link=nNode;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;nNode-&amp;gt;link=NULL;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;break;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;default:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\n**************Error**************\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Press 1 to enter new node or other no. to exit: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;tempPtr=start;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nInfo in linked list:\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;display(start);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return (0);&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-insert-infoelements-in.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhupCWIcCQoKPXYqB-gwDZDsanLSngpb55LoAUHz4YMkYghexottumuIkt0PE8T4BNtgJG9oih2afIBL6B6mg4bSua9RZwbEQx2wreLv2Er1DxnQelnA3rT_8ljNAYzqRXrwssXdW6Ysfs/s72-c/LinkedListInsertion.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-760591623633889456</guid><pubDate>Sun, 24 Jan 2016 19:19:00 +0000</pubDate><atom:updated>2016-03-24T12:00:06.150-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">Linked List</category><category domain="http://www.blogger.com/atom/ns#">list</category><title>Write a program to search a node of the Linked List.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEhkyZEf-ydBdCjvNqpKMaeVhhoKJ3FCBsXS_8aM8X0L05W23SdYa-VyAucrPOIh-SgWwNpUQNnVjXuG5ufBdDfzm0cWep9DITI2uj6jzhYlE_Q1Pv7JkntqB14ZMTJnVg9GZ39TkJc9R3E/s1600/LinkedListSrch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;115&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkyZEf-ydBdCjvNqpKMaeVhhoKJ3FCBsXS_8aM8X0L05W23SdYa-VyAucrPOIh-SgWwNpUQNnVjXuG5ufBdDfzm0cWep9DITI2uj6jzhYlE_Q1Pv7JkntqB14ZMTJnVg9GZ39TkJc9R3E/s400/LinkedListSrch.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
struct node {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int info;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node* link;&lt;br /&gt;
}*start,*nNode;&lt;br /&gt;
node * createNew(int in) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;nNode = new node;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;nNode-&amp;gt;info=in;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return (nNode);&lt;br /&gt;
}&lt;br /&gt;
node display(node* temp) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;while(temp!=NULL) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;temp-&amp;gt;info&amp;lt;&amp;lt;&quot; &amp;nbsp;&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;temp=temp-&amp;gt;link;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
}&lt;br /&gt;
node * search(node* tempPtr,int item) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;while(tempPtr!=NULL &amp;amp;&amp;amp; tempPtr-&amp;gt;info!=item) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;tempPtr=tempPtr-&amp;gt;link;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return (tempPtr);&lt;br /&gt;
}&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n=2,s,item;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int a[8]={7,9,8,5,4,6,2,1};&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;start=NULL;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node* tempPtr;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for (int i = 0; i &amp;lt; 8; ++i)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(start==NULL) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;start=createNew(a[i]);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;start-&amp;gt;link=NULL;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;nNode=createNew(a[i]);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;nNode-&amp;gt;link=start;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;start=nNode;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Elements of linked list: \n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;display(start);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter element you want to search: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;item;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;tempPtr=search(start,item);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (tempPtr!=NULL &amp;amp;&amp;amp; tempPtr-&amp;gt;info==item) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Item found in list.\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Item doesn&#39;t exists in list.\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-search-node-of-linked.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkyZEf-ydBdCjvNqpKMaeVhhoKJ3FCBsXS_8aM8X0L05W23SdYa-VyAucrPOIh-SgWwNpUQNnVjXuG5ufBdDfzm0cWep9DITI2uj6jzhYlE_Q1Pv7JkntqB14ZMTJnVg9GZ39TkJc9R3E/s72-c/LinkedListSrch.PNG" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-1124567056454538031</guid><pubDate>Sat, 23 Jan 2016 19:39:00 +0000</pubDate><atom:updated>2016-03-24T12:00:39.278-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">math</category><title>Write a program to solve a quadratic equation.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEhdQjlFULWEJVmlVGaOcyHS97PcyhON90RX9CSuG86lqmlDCq75f3PeFCQ13bxwqcwG1NkJ_YHUpN6b8R3MM7ssYpqLEgEX0E3Sn4lPNrpBAVksqN9utk8fXa51EUgqeMmaF0cjtGX7l5I/s1600/QuadicEq.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;86&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdQjlFULWEJVmlVGaOcyHS97PcyhON90RX9CSuG86lqmlDCq75f3PeFCQ13bxwqcwG1NkJ_YHUpN6b8R3MM7ssYpqLEgEX0E3Sn4lPNrpBAVksqN9utk8fXa51EUgqeMmaF0cjtGX7l5I/s400/QuadicEq.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int a,b,c,d=0,x;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter a,b &amp;amp; c:&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;a&amp;gt;&amp;gt;b&amp;gt;&amp;gt;c;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;d=(b*b)-4*a*c;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Result:\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(d&amp;lt;0)&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;d&amp;lt;0&quot;&amp;lt;&amp;lt;endl;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;(-b-sqrt(d))/2*a&amp;lt;&amp;lt;endl;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;(-b+sqrt(d))/2*a&amp;lt;&amp;lt;endl;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else if(d==0) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;D=0&quot;&amp;lt;&amp;lt;endl;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;-b/2*a&amp;lt;&amp;lt;endl;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;D&amp;gt;0&quot;&amp;lt;&amp;lt;endl;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Imaginary number: &quot;&amp;lt;&amp;lt;endl;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-solve-quadratic.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdQjlFULWEJVmlVGaOcyHS97PcyhON90RX9CSuG86lqmlDCq75f3PeFCQ13bxwqcwG1NkJ_YHUpN6b8R3MM7ssYpqLEgEX0E3Sn4lPNrpBAVksqN9utk8fXa51EUgqeMmaF0cjtGX7l5I/s72-c/QuadicEq.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-8374725310064128407</guid><pubDate>Sat, 23 Jan 2016 19:35:00 +0000</pubDate><atom:updated>2016-03-24T12:01:10.474-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">sort</category><title>Write a program to sort elements of an array using Merge Sort.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEhIZnkUIzpoaOn3SE5MdsdPDY4jM1-pNtxNPZ3iBGtREg-9fvkoqmRIg8cHqLUAZ_5N3czYY3fiECj2QtcIRDY5iC47z0_3cDZOa1ZXpm8dCRB_ptHQKKodOydkndsw7-6UoyjQGPbHwHU/s1600/mergSort.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;125&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIZnkUIzpoaOn3SE5MdsdPDY4jM1-pNtxNPZ3iBGtREg-9fvkoqmRIg8cHqLUAZ_5N3czYY3fiECj2QtcIRDY5iC47z0_3cDZOa1ZXpm8dCRB_ptHQKKodOydkndsw7-6UoyjQGPbHwHU/s400/mergSort.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int mergeSort(int a[],int beg,int end);&lt;br /&gt;
int merge(int a[],int beg,int mid,int end);&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n,a[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;mergeSort(a,0,n-1);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Array after Sorting using Merge Sort:\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;a[x]&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;br /&gt;
int mergeSort(int a[],int beg,int end)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(end &amp;lt;= beg) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return(0);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int mid=(beg+end)/2;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;mergeSort(a,beg,mid);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;mergeSort(a,mid+1,end);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;merge(a,beg,mid,end);&lt;br /&gt;
}&lt;br /&gt;
int merge(int a[],int beg,int mid,int end)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int h=beg,i=beg,j=mid+1;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int b[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;while(h&amp;lt;=mid &amp;amp;&amp;amp; j&amp;lt;=end) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(a[h]&amp;lt;=a[j]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;b[i]=a[h];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;i++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;h++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;b[i]=a[j];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;i++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;j++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(h&amp;gt;mid) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int k=j;k&amp;lt;=end;k++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;b[i]=a[k];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;i++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int k=h;k&amp;lt;=mid;k++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;b[i]=a[k];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;i++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int k=beg;k&amp;lt;=end;k++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;a[k]=b[k];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-sort-elements-of-array_39.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIZnkUIzpoaOn3SE5MdsdPDY4jM1-pNtxNPZ3iBGtREg-9fvkoqmRIg8cHqLUAZ_5N3czYY3fiECj2QtcIRDY5iC47z0_3cDZOa1ZXpm8dCRB_ptHQKKodOydkndsw7-6UoyjQGPbHwHU/s72-c/mergSort.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-6579000680106576943</guid><pubDate>Sat, 23 Jan 2016 19:31:00 +0000</pubDate><atom:updated>2016-03-24T12:02:03.574-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">search</category><title>Write a program to search an element of an array using binary search.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEgJ29pA41UIR6koGJ-Wp0fPT6ieKow8WvgP-6SR67hY0sSXAS3lSMN-CKk72aUdivHxgv1J5bEXAL4JFa6LW3nPIMHlhq4LLEOLU0YMmwiVD1sL1oAy51m3FU5bb0DWUBv208UiJR4Da34/s1600/binarySearch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ29pA41UIR6koGJ-Wp0fPT6ieKow8WvgP-6SR67hY0sSXAS3lSMN-CKk72aUdivHxgv1J5bEXAL4JFa6LW3nPIMHlhq4LLEOLU0YMmwiVD1sL1oAy51m3FU5bb0DWUBv208UiJR4Da34/s400/binarySearch.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
#include &amp;lt;iostream.h&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int a[100];&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n,item,loc;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int binary(int beg,int end,int item);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of elements: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; elements in Sorted Order: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int i=0;i&amp;lt;n;i++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[i];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter item you want to search: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;item;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;loc=binary(0,n,item);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(a[loc]==item) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nData is Found at Location: &quot;&amp;lt;&amp;lt;loc&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Data is Not Found&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
int binary(int beg,int end,int item)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int mid=(beg+end)/2;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (end &amp;lt; beg) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return -1;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (a[mid]==item) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return(mid);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else if(a[mid]&amp;lt;item) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;binary(mid+1,end,item);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;binary(beg,mid-1,item);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-search-element-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ29pA41UIR6koGJ-Wp0fPT6ieKow8WvgP-6SR67hY0sSXAS3lSMN-CKk72aUdivHxgv1J5bEXAL4JFa6LW3nPIMHlhq4LLEOLU0YMmwiVD1sL1oAy51m3FU5bb0DWUBv208UiJR4Da34/s72-c/binarySearch.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-1768412259104049887</guid><pubDate>Sat, 23 Jan 2016 19:27:00 +0000</pubDate><atom:updated>2016-03-24T12:03:08.792-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">search</category><title>Write a program to search a value from an array in C++.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;In computer science, a search data structure is any data structure that allows the efficient retrieval of specific items from a set of items, such as a specific record from a database.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The simplest, most general, and least efficient search structure is merely an unordered sequential list of all the items. Locating the desired item in such a list, by the linear search method, inevitably requires a number of operations proportional to the number n of items, in the worst case as well as in the average case. Useful search data structures allow faster retrieval; however, they are limited to queries of some specific kind. Moreover, since the cost of building such structures is at least proportional to n, they only pay off if several queries are to be performed on the same database (or on a database that changes little between queries).&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Search_data_structure&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&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/AVvXsEi_wjWuFTry-85YGdK6Lk4800KY0zge_onox7pQ8zOKdZ1esaCorLRd7e-mZ9ONRMfcw1Lvq-yn6RblZ6LTOFgQ6ZA6_VhL1CsZPgfSdsqZAyx0P02u-RjiDVZIrUBKFUgfij-dJvzLPvw/s1600/search.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;105&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_wjWuFTry-85YGdK6Lk4800KY0zge_onox7pQ8zOKdZ1esaCorLRd7e-mZ9ONRMfcw1Lvq-yn6RblZ6LTOFgQ6ZA6_VhL1CsZPgfSdsqZAyx0P02u-RjiDVZIrUBKFUgfij-dJvzLPvw/s400/search.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int loc,n,data,a[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Entered array is: &quot;&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;a[x]&amp;lt;&amp;lt;&quot; &amp;nbsp;&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nEnter data to search: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;data;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(data==a[x]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Location is: &quot;&amp;lt;&amp;lt;x&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;loc=x;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;break;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;loc=x;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(data!=a[loc]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Element not found\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-search-value-from-array.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_wjWuFTry-85YGdK6Lk4800KY0zge_onox7pQ8zOKdZ1esaCorLRd7e-mZ9ONRMfcw1Lvq-yn6RblZ6LTOFgQ6ZA6_VhL1CsZPgfSdsqZAyx0P02u-RjiDVZIrUBKFUgfij-dJvzLPvw/s72-c/search.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7522772750261836479</guid><pubDate>Sat, 23 Jan 2016 19:23:00 +0000</pubDate><atom:updated>2016-03-24T12:03:34.014-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">sort</category><title>Write a program to sort elements of an array using Insertion Sort.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEiDBW4UhyuBjBISvVj8p1QT-_WyksOU5fKVvT33jLkgiHt6MIXWA10iVrElnCziSfTsXlhyphenhyphenaZptInaw0QCJhnidW65OIPQxxybkOW3tUpcO2llA9SvYfBr9733CFZMuWkAuq_Aq8Vq22Gc/s1600/insertionSort.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Screenshot&quot; border=&quot;0&quot; height=&quot;142&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDBW4UhyuBjBISvVj8p1QT-_WyksOU5fKVvT33jLkgiHt6MIXWA10iVrElnCziSfTsXlhyphenhyphenaZptInaw0QCJhnidW65OIPQxxybkOW3tUpcO2llA9SvYfBr9733CFZMuWkAuq_Aq8Vq22Gc/s400/insertionSort.PNG&quot; title=&quot;Program Screenshot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
int insertionSort(int a[],int n);&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n,data,a[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;insertionSort(a,n);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Array after Sorting using Insertion Sort: \n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;a[x]&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;br /&gt;
int insertionSort(int a[],int n)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int pivot,temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int startPos=1;startPos&amp;lt;n;startPos++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;pivot=startPos;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;while(pivot &amp;gt;= 1 &amp;amp;&amp;amp; a[pivot] &amp;lt; a[pivot-1]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;temp=a[pivot];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[pivot]=a[pivot-1];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[pivot-1]=temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pivot--;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-sort-elements-of-array_23.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDBW4UhyuBjBISvVj8p1QT-_WyksOU5fKVvT33jLkgiHt6MIXWA10iVrElnCziSfTsXlhyphenhyphenaZptInaw0QCJhnidW65OIPQxxybkOW3tUpcO2llA9SvYfBr9733CFZMuWkAuq_Aq8Vq22Gc/s72-c/insertionSort.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-1423117871920814935</guid><pubDate>Mon, 18 Jan 2016 19:07:00 +0000</pubDate><atom:updated>2016-03-24T12:04:00.907-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">math</category><title>Write a program to find first n prime numbers.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEjgeLO8KAF4svrVIctAxYRs4NB553NWVKQSWwv1GfMIT2CTQugpAJeOow9gMBO25J_rlgyssdlEjA0rOSD6E8WdkL8HxgKYTFqE3TmV_EZKVUi6iUMa6JlAdKM5UViBh3u9BitYjylgFCo/s1600/primeNnum.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program ScreenShot&quot; border=&quot;0&quot; height=&quot;111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgeLO8KAF4svrVIctAxYRs4NB553NWVKQSWwv1GfMIT2CTQugpAJeOow9gMBO25J_rlgyssdlEjA0rOSD6E8WdkL8HxgKYTFqE3TmV_EZKVUi6iUMa6JlAdKM5UViBh3u9BitYjylgFCo/s400/primeNnum.PNG&quot; title=&quot;Program ScreenShot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
#include &amp;lt;iostream.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int n, i = 3, count, c;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;&quot;Enter the number of prime numbers required: &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;if ( n &amp;gt;= 1 ) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;First &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; prime numbers are:\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot;2\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;count = 2 ;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;while (count &amp;lt;= n) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; for ( c = 2 ; c &amp;lt;= i - 1 ; c++ ) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ( i%c == 0 )&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if ( c == i ) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;i&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;count++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; i++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return 0;&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-find-first-n-prime.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgeLO8KAF4svrVIctAxYRs4NB553NWVKQSWwv1GfMIT2CTQugpAJeOow9gMBO25J_rlgyssdlEjA0rOSD6E8WdkL8HxgKYTFqE3TmV_EZKVUi6iUMa6JlAdKM5UViBh3u9BitYjylgFCo/s72-c/primeNnum.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-6288820581461789020</guid><pubDate>Sun, 17 Jan 2016 19:10:00 +0000</pubDate><atom:updated>2016-03-24T12:04:31.101-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">number</category><title>Write a program to find a largest number from n numbers.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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/AVvXsEgADaI9qS0jPxobkC0FrYEHDs6aMaPTvVGUvFeP26mYbrgET5GDjITcliG8Aq0eqiKq6Uh2ubWzhHSkW3wdOOFITEmXgoKzTugqmliSDzIjqHkUPGqkqHrJ0OlfmSutMZj5kai6WofX59k/s1600/LargestN.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program ScreenShot&quot; border=&quot;0&quot; height=&quot;83&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgADaI9qS0jPxobkC0FrYEHDs6aMaPTvVGUvFeP26mYbrgET5GDjITcliG8Aq0eqiKq6Uh2ubWzhHSkW3wdOOFITEmXgoKzTugqmliSDzIjqHkUPGqkqHrJ0OlfmSutMZj5kai6WofX59k/s400/LargestN.PNG&quot; title=&quot;Program ScreenShot&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int z,n,a[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;z=a[0];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=1;x&amp;lt;n;x++)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(z&amp;lt;a[x]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;z=a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Largest: &quot;&amp;lt;&amp;lt;z&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-find-largest-number.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgADaI9qS0jPxobkC0FrYEHDs6aMaPTvVGUvFeP26mYbrgET5GDjITcliG8Aq0eqiKq6Uh2ubWzhHSkW3wdOOFITEmXgoKzTugqmliSDzIjqHkUPGqkqHrJ0OlfmSutMZj5kai6WofX59k/s72-c/LargestN.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7601510646935471834</guid><pubDate>Sat, 16 Jan 2016 19:50:00 +0000</pubDate><atom:updated>2016-03-24T12:05:04.234-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">2d array</category><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">math</category><title>Write a program to calculate sum of the elements of an 2D array.</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/AVvXsEh1F-3NicPGXAd4q0-fu5gQKyomr6XXExnHBwcGOmd6Rwd4UEkjkaZl3yYwyDkitAVzaQT4FUDhXC6kN-cHcL77WqEFPA_caiOCqRjj-nvnYxTALm4JbIXo2nvtNilgACfh2Ue8u-xelZE/s1600/2dArrayEleSum.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Program ScreenShot&quot; border=&quot;0&quot; height=&quot;112&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1F-3NicPGXAd4q0-fu5gQKyomr6XXExnHBwcGOmd6Rwd4UEkjkaZl3yYwyDkitAVzaQT4FUDhXC6kN-cHcL77WqEFPA_caiOCqRjj-nvnYxTALm4JbIXo2nvtNilgACfh2Ue8u-xelZE/s400/2dArrayEleSum.PNG&quot; title=&quot;Program ScreenShot&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
#include&amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int a[100][100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int r,c;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of rows &amp;amp; columns: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;r&amp;gt;&amp;gt;c;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;r*c&amp;lt;&amp;lt;&quot; values : &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int i=0;i&amp;lt;r;i++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int j=0;j&amp;lt;c;j++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;cin&amp;gt;&amp;gt;a[i][j];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int i=0;i&amp;lt;r;i++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int j=0;j&amp;lt;c;j++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[i][c]+=a[i][j];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int i=0;i&amp;lt;r;i++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int j=0;j&amp;lt;c+1;j++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[r][j]+=a[i][j];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;SUM : &quot;&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int i=0;i&amp;lt;r+1;i++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;for(int j=0;j&amp;lt;c+1;j++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;cout&amp;lt;&amp;lt;a[i][j]&amp;lt;&amp;lt;&quot;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-calculate-sum-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1F-3NicPGXAd4q0-fu5gQKyomr6XXExnHBwcGOmd6Rwd4UEkjkaZl3yYwyDkitAVzaQT4FUDhXC6kN-cHcL77WqEFPA_caiOCqRjj-nvnYxTALm4JbIXo2nvtNilgACfh2Ue8u-xelZE/s72-c/2dArrayEleSum.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-7814356961112559581</guid><pubDate>Sat, 16 Jan 2016 19:43:00 +0000</pubDate><atom:updated>2016-03-24T12:05:44.461-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">sort</category><title>Write a program to sort elements of an array using Quick Sort.</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/AVvXsEg4jRQjrHnRSJtsUHuHC1MZWJxuCuRdGCZlXLWL39Kk8NWSTC_43v3A5ExNVCkW9Ahs9zuXyq2vximk0bRwR178dZytlTwRsStU4w7C3KZbQOEtZp7Uz3TZgzXxX79CQt5oT9HMoMQwsJM/s1600/QuickSort.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Program ScreenShot&quot; border=&quot;0&quot; height=&quot;112&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4jRQjrHnRSJtsUHuHC1MZWJxuCuRdGCZlXLWL39Kk8NWSTC_43v3A5ExNVCkW9Ahs9zuXyq2vximk0bRwR178dZytlTwRsStU4w7C3KZbQOEtZp7Uz3TZgzXxX79CQt5oT9HMoMQwsJM/s400/QuickSort.PNG&quot; title=&quot;Program ScreenShot&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
int quickSort(int a[],int l,int r);&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n,data,a[100];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values : &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;a[x];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;quickSort(a,0,n);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Array after Sorting using Quick Sort: \n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;a[x]&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;
}&lt;br /&gt;
int quickSort(int a[],int l,int r)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(r-l&amp;lt;=1) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return(0);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int y=l+1;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int g=l+1;g&amp;lt;r;g++) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(a[g]&amp;lt;=a[l]) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;temp=a[y];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[y]=a[g];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;a[g]=temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;y++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;temp=a[y-1];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;a[y-1]=a[l];&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;a[l]=temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;quickSort(a,l,y-1);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;quickSort(a,y,r);&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-sort-elements-of-array_16.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4jRQjrHnRSJtsUHuHC1MZWJxuCuRdGCZlXLWL39Kk8NWSTC_43v3A5ExNVCkW9Ahs9zuXyq2vximk0bRwR178dZytlTwRsStU4w7C3KZbQOEtZp7Uz3TZgzXxX79CQt5oT9HMoMQwsJM/s72-c/QuickSort.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-9144130756158903320</guid><pubDate>Sat, 16 Jan 2016 19:38:00 +0000</pubDate><atom:updated>2016-08-29T13:53:17.436-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">sort</category><title>Write a program to sort elements of an array using Bubble Sort.</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: #333333; font-family: helvetica, arial, sans-serif; line-height: 22.5px;&quot;&gt;
&lt;div style=&quot;font-size: 15px;&quot;&gt;
&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;Bubble sort&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;, sometimes referred to as&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;sinking sort&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;, is a simple&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Sorting_algorithm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot;&gt;sorting algorithm&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;that repeatedly steps through the list to be sorted, compares each pair of adjacent items and&amp;nbsp;&lt;/span&gt;&lt;a class=&quot;mw-redirect&quot; href=&quot;https://en.wikipedia.org/wiki/Swap_(computer_science)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot;&gt;swaps&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;them if they are in the wrong order.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 15px;&quot;&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 15px;&quot;&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm, which is a&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Comparison_sort&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot;&gt;comparison sort&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;, is named for the way smaller elements &quot;bubble&quot; to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems even when compared to&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Insertion_sort&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot;&gt;insertion sort&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;It can be practical if the input is usually in sorted order but may occasionally have some out-of-order elements nearly in position.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 15px;&quot;&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom: none; color: black; font-family: sans-serif; line-height: 1.6; margin: 0.3em 0px 0px; overflow: hidden; padding-bottom: 0px; padding-top: 0.5em; text-align: left;&quot;&gt;
&lt;span class=&quot;mw-headline&quot; id=&quot;Performance&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Performance:-&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Best case:&amp;nbsp;&lt;b&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;O&lt;/i&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;(&lt;/span&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;n&lt;/i&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Average case:&amp;nbsp;&lt;b&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;О&lt;/i&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;(&lt;/span&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;n&lt;/i&gt;&lt;sup style=&quot;color: #252525; font-family: sans-serif; font-size: 11.2px; line-height: 1;&quot;&gt;2&lt;/sup&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Worst case:&amp;nbsp;&lt;b&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;О&lt;/i&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;(&lt;/span&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;n&lt;/i&gt;&lt;sup style=&quot;color: #252525; font-family: sans-serif; font-size: 11.2px; line-height: 1;&quot;&gt;2&lt;/sup&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 15px;&quot;&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; rel=&quot;nofollow&quot; style=&quot;color: #2361a1; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&gt;&lt;/h2&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/AVvXsEiZCsnMYgePl46DcHQcAFb-8voYzieXVN5ivmP3lFKc1WSLs_b0DgEZber0iAlNkX3WiPrdeaJL2lJcYwqWyBBOtKeN_4pt8oMC5cmTNIDACZ147pzw1dFzjbwgs7cECAoUMWMyDPeju7Y/s1600/ptrBubble.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program Output&quot; border=&quot;0&quot; height=&quot;111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZCsnMYgePl46DcHQcAFb-8voYzieXVN5ivmP3lFKc1WSLs_b0DgEZber0iAlNkX3WiPrdeaJL2lJcYwqWyBBOtKeN_4pt8oMC5cmTNIDACZ147pzw1dFzjbwgs7cECAoUMWMyDPeju7Y/s400/ptrBubble.PNG&quot; title=&quot;Program Output&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;using namespace std;&lt;br /&gt;int bubble(int *ptr,int n);&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int n,data,a[100];&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int *ptr;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ptr=a;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter no. of values: &quot;;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;n;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;n&amp;lt;&amp;lt;&quot; values: &quot;;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cin&amp;gt;&amp;gt;*(ptr+x);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;bubble(ptr,n);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;Array after Sorting using BUBBLE Sort: \n&quot;;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int x=0;x&amp;lt;n;x++) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cout&amp;lt;&amp;lt;*(ptr+x)&amp;lt;&amp;lt;&quot;\n&quot;;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return(0);&lt;br /&gt;}&lt;br /&gt;int bubble(int *ptr,int n)&lt;br /&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int x,temp;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;for(int k=0;k&amp;lt;n;k++) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;x=0;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;while(x&amp;lt;n-k-1) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if(*(ptr+x)&amp;gt;*(ptr+x+1)) {&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;temp=*(ptr+x+1);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;*(ptr+x+1)=*(ptr+x);&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;*(ptr+x)=temp;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;x=x+1;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;}&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-sort-elements-of-array.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZCsnMYgePl46DcHQcAFb-8voYzieXVN5ivmP3lFKc1WSLs_b0DgEZber0iAlNkX3WiPrdeaJL2lJcYwqWyBBOtKeN_4pt8oMC5cmTNIDACZ147pzw1dFzjbwgs7cECAoUMWMyDPeju7Y/s72-c/ptrBubble.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5366762931879462197.post-316194447629422127</guid><pubDate>Sat, 16 Jan 2016 19:09:00 +0000</pubDate><atom:updated>2016-08-23T12:02:46.089-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">C Plus Plus</category><category domain="http://www.blogger.com/atom/ns#">C++</category><title>Write a program to reverse the elements of an array.</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: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;An&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;array type&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;is a&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Data_type&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Data type&quot;&gt;data type&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;that is meant to describe a collection of&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;elements&lt;/i&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;(&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Value_(computer_science)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Value (computer science)&quot;&gt;values&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;or&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Variable_(computer_science)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Variable (computer science)&quot;&gt;variables&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;), each selected by one or more indices (identifying keys) that can be computed at&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Run_time_(program_lifecycle_phase)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Run time (program lifecycle phase)&quot;&gt;run time&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;by the program. Such a collection is usually called an&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;array variable&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;array value&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;, or simply&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;array&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;By analogy with the mathematical concepts of&amp;nbsp;&lt;/span&gt;&lt;a class=&quot;mw-redirect&quot; href=&quot;https://en.wikipedia.org/wiki/Vector_(mathematics)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Vector (mathematics)&quot;&gt;vector&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_(mathematics)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Matrix (mathematics)&quot;&gt;matrix&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;, array types with one and two indices are often called&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;vector type&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;matrix type&lt;/b&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;, respectively.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;In order to effectively implement variables of such types as&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Array_data_structure&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Array data structure&quot;&gt;array structures&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;(with indexing done by&amp;nbsp;&lt;/span&gt;&lt;a class=&quot;mw-redirect&quot; href=&quot;https://en.wikipedia.org/wiki/Pointer_arithmetic&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Pointer arithmetic&quot;&gt;pointer arithmetic&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;), many languages restrict the indices to&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Integer_(computer_science)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Integer (computer science)&quot;&gt;integer&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;data types (or other types that can be interpreted as integers, such as&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Byte&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Byte&quot;&gt;bytes&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Enumerated_type&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Enumerated type&quot;&gt;enumerated types&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;), and require that all elements have the same data type and storage size. Most of those languages also restrict each index to a finite&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Interval_(mathematics)&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Interval (mathematics)&quot;&gt;interval&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;of integers, that remains fixed throughout the lifetime of the array variable. In some&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Compiler&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Compiler&quot;&gt;compiled&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;&amp;nbsp;languages, in fact, the index ranges may have to be known at&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Compile_time&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0b0080; font-family: sans-serif; font-size: 14px; line-height: 22.4px; text-decoration: none;&quot; title=&quot;Compile time&quot;&gt;compile time&lt;/a&gt;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 14px; line-height: 22.4px;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
Information source:&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; rel=&quot;nofollow&quot; style=&quot;color: #2361a1; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;wikipedia.org&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #333333; font-family: helvetica, arial, sans-serif; font-size: 15px; line-height: 22.5px;&quot;&gt;
&lt;b&gt;Program:-&amp;gt;&lt;/b&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/AVvXsEgj0_mx3DIxMBAjiVmIjfgphUH0CfgYa8n2Reb-rIUf3UA5xaP-I63voj3ZMYHHQ4K5j5widd3kdN8vqzEcJf5I1S5pOq6TJzYtFHr5C-wV3L8GZVWR_Ql4GMHtNVIRn5B9uscLuIvAdL4/s1600/arrayRev.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Program ScreenShot&quot; border=&quot;0&quot; height=&quot;82&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0_mx3DIxMBAjiVmIjfgphUH0CfgYa8n2Reb-rIUf3UA5xaP-I63voj3ZMYHHQ4K5j5widd3kdN8vqzEcJf5I1S5pOq6TJzYtFHr5C-wV3L8GZVWR_Ql4GMHtNVIRn5B9uscLuIvAdL4/s400/arrayRev.PNG&quot; title=&quot;&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;Output&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
#include &amp;lt;iostream.h&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int arr[30], i, j, num, temp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;&quot;Enter no. of elements : &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;cin&amp;gt;&amp;gt;num;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;&quot;Enter &quot;&amp;lt;&amp;lt;num&amp;lt;&amp;lt;&quot; values : &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for (i = 0; i &amp;lt; num; i++) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;arr[i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;j = num - 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;i = 0; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;while (i &amp;lt; j) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; temp = arr[i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; arr[i] = arr[j];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; arr[j] = temp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; i++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; j--;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;&quot;\nResult after reversal : &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for (i = 0; i &amp;lt; num; i++) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;arr[i]&amp;lt;&amp;lt;&quot; &amp;nbsp; &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return (0);&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://progrmitx.blogspot.com/2016/01/write-program-to-reverse-elements-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0_mx3DIxMBAjiVmIjfgphUH0CfgYa8n2Reb-rIUf3UA5xaP-I63voj3ZMYHHQ4K5j5widd3kdN8vqzEcJf5I1S5pOq6TJzYtFHr5C-wV3L8GZVWR_Ql4GMHtNVIRn5B9uscLuIvAdL4/s72-c/arrayRev.PNG" height="72" width="72"/><thr:total>1</thr:total></item></channel></rss>