<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='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'><id>tag:blogger.com,1999:blog-3966777529669130115</id><updated>2025-05-02T07:16:34.725+05:30</updated><category term="C Programs"/><category term="Graphics Programs"/><category term="Java Programs"/><category term="C#"/><category term="Opengl"/><category term=".NET"/><category term="C#.NET"/><category term="Dot Net"/><category term="Java Scripts"/><category term="Video Tutorials"/><category term="Sorting"/><category term="c# beginner"/><category term="Pattern"/><category term="Star Pattern"/><category term="Array"/><category term="Presentations"/><category term="c programs pdf"/><category term="computer programming"/><category term="C# Program to find Fibonacci Sequence"/><category term="Tips and Tricks"/><category term="c programming help"/><category term="c# developer"/><category term="c# development"/><category term="c# programming"/><category term="c# programming help"/><category term="classes java"/><category term="computer graphic program"/><category term="factorial in c#"/><category term="fibonacci number in c#"/><category term="graphics library"/><category term="graphics programming in c"/><category term="java classes tutorial"/><category term="javascript classes"/><category term="learn c#"/><category term="learn to code c#"/><category term="uses of c# programming language"/><category term="2d graphics library"/><category term="C"/><category term="C beginners"/><category term="Design Pattern"/><category term="Factorial using do-while loop"/><category term="Factorial using for loop"/><category term="Fibonacci Sequence"/><category term="Generics"/><category term="Python"/><category term="android"/><category term="android tutorials"/><category term="c programming for beginners"/><category term="c programming online course"/><category term="c programming tutorials"/><category term="c# sample code"/><category term="c++ graphics programming"/><category term="classes"/><category term="computer graphics programs"/><category term="continuous logo loop"/><category term="continuous marquee"/><category term="css"/><category term="custom software development"/><category term="design pattern in c#"/><category term="do-while loop"/><category term="enable developer options"/><category term="find maximum from array"/><category term="flatten a  hierarchical collection of objects in Linq"/><category term="for loop"/><category term="graphics programming in c++"/><category term="html"/><category term="inheritance"/><category term="interface"/><category term="java classes"/><category term="java crash course"/><category term="java online course"/><category term="java tutorial"/><category term="jquery"/><category term="jquery marquee"/><category term="learning c programming"/><category term="learning to code"/><category term="library graphics"/><category term="linq"/><category term="multilevel droupdown menu in linq"/><category term="multilevel menu"/><category term="programming c"/><category term="runtime polymorphism"/><category term="sequence of number"/><category term="singleton"/><category term="software development design patterns"/><category term="software development methodologies"/><category term="techy tweets"/><title type='text'>CFETCH</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>116</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-3910616443668823689</id><published>2016-11-20T22:10:00.000+05:30</published><updated>2016-11-20T22:10:58.892+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="android tutorials"/><category scheme="http://www.blogger.com/atom/ns#" term="classes java"/><category scheme="http://www.blogger.com/atom/ns#" term="enable developer options"/><category scheme="http://www.blogger.com/atom/ns#" term="java classes tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="Java Programs"/><category scheme="http://www.blogger.com/atom/ns#" term="techy tweets"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="Video Tutorials"/><title type='text'>How to enable and disable developer options in Android.</title><content type='html'>&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/AVvXsEjXEGYOgvI_LGwf61NVGI0vVW4_xgbDfxP7MDi6GU1cJK_cU6ZPx5AJC4kNpAaXYO0DMkPVPBqfFSxKe2U_bDB3sETvoIdq4OXKfr982Qxq7II11Y0iWN81eWhj1-6OxNk-gQlL-7nxY54/s1600/Video+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXEGYOgvI_LGwf61NVGI0vVW4_xgbDfxP7MDi6GU1cJK_cU6ZPx5AJC4kNpAaXYO0DMkPVPBqfFSxKe2U_bDB3sETvoIdq4OXKfr982Qxq7II11Y0iWN81eWhj1-6OxNk-gQlL-7nxY54/s1600/Video+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Hey, Guys!! Today in this post we will be talking about how to enable developer options in android. If we talk in the context of developer option it is the basic step in order to allow debugging on a physical device. Let&#39;s check out the steps to enable developer options.&lt;br /&gt;
&lt;br /&gt;
1. Navigate to settings.&lt;br /&gt;
2. Search for About Phone&lt;br /&gt;
3. In About Phone check for Builder number and press on it for 7 times.&lt;br /&gt;
&lt;br /&gt;
As soon as you click the seventh time it will show you a message &quot;You are a developer&quot;. Our work is done your device is now ready to start debugging.&lt;br /&gt;
&lt;br /&gt;
Disable developer option:&lt;br /&gt;
&lt;br /&gt;
1. Turn of developer option.&lt;br /&gt;
2. Go to Apps and search for settings.&lt;br /&gt;
3. Clear settings data&lt;br /&gt;
&lt;br /&gt;
And here we have successfully disabled developer option. I have also provided a video tutorial for enabling developer option.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/lSEJ2C96diA&quot; width=&quot;600&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/3910616443668823689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2016/11/how-to-enable-and-disable-developer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/3910616443668823689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/3910616443668823689'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2016/11/how-to-enable-and-disable-developer.html' title='How to enable and disable developer options in Android.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXEGYOgvI_LGwf61NVGI0vVW4_xgbDfxP7MDi6GU1cJK_cU6ZPx5AJC4kNpAaXYO0DMkPVPBqfFSxKe2U_bDB3sETvoIdq4OXKfr982Qxq7II11Y0iWN81eWhj1-6OxNk-gQlL-7nxY54/s72-c/Video+Banner.png" height="72" width="72"/><thr:total>0</thr:total><georss:featurename>Himmatnagar, Gujarat, India</georss:featurename><georss:point>23.6036268 72.96394609999993</georss:point><georss:box>23.4872263 72.802584599999932 23.7200273 73.125307599999928</georss:box></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-6988284249768186721</id><published>2016-08-08T10:06:00.001+05:30</published><updated>2016-08-08T11:12:32.329+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="continuous logo loop"/><category scheme="http://www.blogger.com/atom/ns#" term="continuous marquee"/><category scheme="http://www.blogger.com/atom/ns#" term="css"/><category scheme="http://www.blogger.com/atom/ns#" term="html"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript classes"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery marquee"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to make marquee continuous.</title><content type='html'>&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/AVvXsEj3p3bBFxP90YF5SgmPV8apBHHO3O5fdCFXL8r52b1D9cXRI_Vuyv35BaUNFhx-_QDJJOQkKXn5HaEVhVXas-CuclkhVOwQYo2YVRu4-dvMLHU8gu1m_xq0RHlhe6r_N6FQYoKKnK2wdWM/s1600/TipsandTricks.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3p3bBFxP90YF5SgmPV8apBHHO3O5fdCFXL8r52b1D9cXRI_Vuyv35BaUNFhx-_QDJJOQkKXn5HaEVhVXas-CuclkhVOwQYo2YVRu4-dvMLHU8gu1m_xq0RHlhe6r_N6FQYoKKnK2wdWM/s1600/TipsandTricks.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
I have been searching around the web to find a solution for creating a continuous marquee. And after trying a lot of solution I came up with the perfect solution. And I would like to share it with you all.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The solution that I have found is too simple. It just requires three simple steps and the plugin which i have used will be configured as show in the article below.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;Step 1 : &lt;/b&gt;We have to add a link to the two external JavaScript in the head section of html file. You can use it from CDN or download it and save locally in you project.Here in this example I have used it from the CDN.&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;jquery.marquee.min.js | &lt;a href=&quot;http://cdn.jsdelivr.net/jquery.marquee/1.3.1/jquery.marquee.min.js&quot; target=&quot;_blank&quot;&gt;Download Link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;jquery.pause.js | &lt;a href=&quot;https://rawgithub.com/tobia/Pause/master/jquery.pause.js&quot; target=&quot;_blank&quot;&gt;Download Link&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SCRIPT:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background: #f0f0f0; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span style=&quot;color: #4070a0;&quot;&gt;src=&quot;http://cdn.jsdelivr.net/jquery.marquee/1.3.1/jquery.marquee.min.js&quot;&lt;/span&gt; &lt;span style=&quot;color: #4070a0;&quot;&gt;type=&quot;text/javascript&quot;&lt;/span&gt;&lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span style=&quot;color: #4070a0;&quot;&gt;src=&quot;https://rawgit.com/tobia/Pause/master/jquery.pause.js&quot;&lt;/span&gt; &lt;span style=&quot;color: #4070a0;&quot;&gt;type=&quot;text/javascript&quot;&lt;/span&gt;&lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;Step 2 : &lt;/b&gt;You have to add a class selector to the div. Here in the below example, I have named it&amp;nbsp;as marquee. You can name it whatever you want according to the requirement. And also you need to add &amp;nbsp;some simple CSS&amp;nbsp;for the div as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;HTML:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background: #f0f0f0; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span style=&quot;color: #4070a0;&quot;&gt;class=&#39;marquee&#39;&lt;/span&gt;&lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
       .... 
       images
       ....
    &lt;span style=&quot;color: #062873; font-weight: bold;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;CSS:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background: #f0f0f0; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;.marquee&lt;/span&gt; {
  &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;width&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #40a070;&quot;&gt;300px&lt;/span&gt;; &lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;/* the plugin works for responsive layouts so width is not necessary */&lt;/span&gt;
  &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;overflow&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;hidden&lt;/span&gt;;
  &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;border&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #40a070;&quot;&gt;1px&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;solid&lt;/span&gt; &lt;span style=&quot;color: #40a070;&quot;&gt;#ccc&lt;/span&gt;;
}
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;Step 3 : &lt;/b&gt;How to apply the plugin with option to use this marquee selector class.The basic option you need to provide to to make the marquee continuous are duration and duplicated. You can provide other options as per requirement.&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;b&gt;JAVASCRIPT:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background: #f0f0f0; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6
7
8
9&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;$(&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;function&lt;/span&gt; () {
    $(&lt;span style=&quot;color: #4070a0;&quot;&gt;&#39;.marquee&#39;&lt;/span&gt;).marquee({
        duration&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #40a070;&quot;&gt;5000&lt;/span&gt;,
         duplicated&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;true&lt;/span&gt;,
         gap&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt;, 
         direction&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #4070a0;&quot;&gt;&#39;left&#39;&lt;/span&gt;,
         pauseOnHover&lt;span style=&quot;color: #666666;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;true&lt;/span&gt;
    });
});
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
If you want to explore more about this JavaScript follow the link: &lt;a href=&quot;https://github.com/aamirafridi/jQuery.Marquee&quot; target=&quot;_blank&quot;&gt;aamirafridi/jQuery.Marquee&lt;/a&gt;. You can find more option to configure your marquee.&lt;br /&gt;
&lt;br /&gt;
Check out my sample on JSFiddle: &lt;a href=&quot;http://jsfiddle.net/parth7676/m6jx1qb6/&quot; target=&quot;_blank&quot;&gt;Example 1&lt;/a&gt;&amp;nbsp;| &lt;a href=&quot;http://jsfiddle.net/parth7676/awd4mxop/&quot; target=&quot;_blank&quot;&gt;Example 2&lt;/a&gt;&amp;nbsp;and also my Stack Overflow answer on how to create a continuous marquee logo loop @ &lt;a href=&quot;http://stackoverflow.com/questions/38604929/how-to-create-marquee-infinite-loop-of-logos-slider-with-css-only/38627651#38627651&quot;&gt;Answer Link&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/6988284249768186721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2016/08/how-to-make-marquee-continuous.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/6988284249768186721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/6988284249768186721'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2016/08/how-to-make-marquee-continuous.html' title='How to make marquee continuous.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3p3bBFxP90YF5SgmPV8apBHHO3O5fdCFXL8r52b1D9cXRI_Vuyv35BaUNFhx-_QDJJOQkKXn5HaEVhVXas-CuclkhVOwQYo2YVRu4-dvMLHU8gu1m_xq0RHlhe6r_N6FQYoKKnK2wdWM/s72-c/TipsandTricks.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-2262825096215621510</id><published>2015-11-04T01:07:00.001+05:30</published><updated>2015-11-04T01:09:28.510+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# beginner"/><category scheme="http://www.blogger.com/atom/ns#" term="c# development"/><category scheme="http://www.blogger.com/atom/ns#" term="c# programming"/><category scheme="http://www.blogger.com/atom/ns#" term="c# programming help"/><category scheme="http://www.blogger.com/atom/ns#" term="c# sample code"/><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><category scheme="http://www.blogger.com/atom/ns#" term="find maximum from array"/><category scheme="http://www.blogger.com/atom/ns#" term="learn c#"/><category scheme="http://www.blogger.com/atom/ns#" term="learn to code c#"/><category scheme="http://www.blogger.com/atom/ns#" term="uses of c# programming language"/><title type='text'>C# program to find a maximum number from the array.</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Introduction:&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In this post, we are going to implement a simple program, which requires a simple logic called &quot;Comparison&quot;. Don&#39;t get shocked this is true we are going to implement a simple program which compare array members and give us the largest number among all the numbers as output.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Background:&lt;/h3&gt;
&lt;div&gt;
To implement this program, you must be aware of an array, how to initialize an array? and how to compare to members of an array? I guess that you are familiar with an array and moving towards implementation.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
And if someone is not aware to an array then they can refer this link. &lt;a href=&quot;https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html&quot;&gt;Array&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Implementation:&lt;/h3&gt;
&lt;div&gt;
Implementation of this program is quite simple we just need two for loops one to ask from input from a user and store it in an array and the second to compare the members and find the max one.But here in this program I have used one extra for loop&amp;nbsp;to display the members of an array, by the way, it is not compulsory.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Maximum Body --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;2234400740&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ConsoleApplication5&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;arr&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;];&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;max&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter the 5 number:&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i++)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;arr[i]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Convert.ToInt16(Console.ReadLine());&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Entered Array Values Are:&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i++)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(arr[i]);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;


            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i++)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(arr[i]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;max)&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;max&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;arr[i];&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Maximum Number is:&quot;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;max);&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here I am asking for just five numbers because I have created an integer array of 5 elements.You can specify your own size by just replacing 5 with a size you want.If we talk about logic then I can say that first I have taken integer variable m to store maximum number and initiate it to 0, now when the if condition checks that if there is a number greater than the maximum number then make it maximum and store it in m.This continues until all the members of the array are not compared and finally print the value of m on the console as the maximum value.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
As of in this post today we have seen quite a simple program, in my next post I will come up with an interesting program to share with you.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Please Do share, comment, and subscribe my blog.Enjoy coding!!!!&lt;/div&gt;
&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- C# max Footer --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;3711133949&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/2262825096215621510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/11/c-program-to-find-maximum-number-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/2262825096215621510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/2262825096215621510'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/11/c-program-to-find-maximum-number-from.html' title='C# program to find a maximum number from the array.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-4649315545978596107</id><published>2015-11-01T19:34:00.000+05:30</published><updated>2015-11-03T15:04:36.426+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# developer"/><category scheme="http://www.blogger.com/atom/ns#" term="c# development"/><category scheme="http://www.blogger.com/atom/ns#" term="custom software development"/><category scheme="http://www.blogger.com/atom/ns#" term="Design Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="design pattern in c#"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><category scheme="http://www.blogger.com/atom/ns#" term="learn c#"/><category scheme="http://www.blogger.com/atom/ns#" term="singleton"/><category scheme="http://www.blogger.com/atom/ns#" term="software development design patterns"/><category scheme="http://www.blogger.com/atom/ns#" term="software development methodologies"/><title type='text'>Design Patterns in C#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoPlainText&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The Design pattern is a solution to software design problems you find in real world application development.It is a way in which software are build so that the code may be reusable when required.The selection of appropriate design pattern is very necessary, before starting the development of any software.It is not&amp;nbsp;&lt;/span&gt;compulsory&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;that you have to select design pattern from the available list, you can make your own custom pattern also.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
While solving &amp;nbsp;a particular problem, you come up with a solution &amp;nbsp;that can be reused at many of the solutions on which you are working then you can select that structure of solving the problem as your custom design pattern.Make your own class libraries and share it within your company.It will be your custom design pattern.&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -.25in;&quot;&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;font-stretch: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Patterns are about reusable designs and interaction of objects.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;font-stretch: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;It is the best practice used by experienced software developers.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;font-stretch: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;font-stretch: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Patterns &amp;nbsp;are categorized in 3 major groups:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: 1.5in; mso-list: l0 level3 lfo1; text-indent: -.25in;&quot;&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Creational Pattern&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Structural Pattern&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Behavioral Pattern&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
There is a big list of design pattern belonging to each of the above group, we are not going to discuss all of them.
Instead, we are going to check out most widely used design patterns in software development.You can check out the list of all the available design pattern at &lt;b&gt;&lt;a href=&quot;https://csharpdesignpatterns.codeplex.com/&quot;&gt;MSDN&lt;/a&gt;. &lt;/b&gt;The most used design patterns are listed below.&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot; style=&quot;margin-left: 1.5in; mso-list: l0 level3 lfo1; text-indent: -.25in;&quot;&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Singleton Pattern&lt;i&gt;(Creational Pattern)&lt;/i&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Factory Method Pattern&lt;i&gt;(Creational Pattern)&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Observer Pattern&lt;i&gt;(Behavioral Pattern)&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Dependency Injection&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
It is difficult to cover all the patterns in a single post, so in this post we are going to explore &lt;b&gt;Singleton Pattern&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Singleton Pattern:&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;Singleton pattern is used when we want to &lt;b&gt;&lt;i&gt;provide global access to the objects, but the constraint &amp;nbsp;is that there must be only single instance&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;i&gt;available &lt;/i&gt;&lt;/b&gt;or we can say we want to implement a class in a way that can be accessed globally, but we can just only make a single instance of that class.In practice, there are many different ways available to implement singleton pattern.but we are going to implement it using the simplest way available.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Factorial [.net] --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;5736583940&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Implementation:&amp;nbsp;&lt;/h4&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Firstly, we have to create a class(singleton) which doesn’t allow to create an object from outside of that class, So this can be achieved using a private constructor.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;singleton&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Now we cannot create the instance of the above class outside that class. This will not fulfill our requirement of exposing an only single instance of the class. To achieve that we have to instantiate the class inside of that class and store that instance in a private static variable. After implementing this requirement, our class will look like this.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;   &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;_instance;&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;singleton&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Instance&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;_instance&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton();&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;_instance;&lt;/span&gt;           
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
     &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Now every time when &amp;nbsp;Instance() method called it will create a new object for that class so this is not what we&amp;nbsp;&lt;/span&gt;actually need.We just need a single instance of that class to be created.&lt;span style=&quot;font-family: inherit;&quot;&gt; So we need to make a simple check to limit the creation of an instance of the singleton class.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
     &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;_instance;&lt;/span&gt;
     &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;singleton&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
     &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
     &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
     &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Instance&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
     &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
         &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(_instance&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt;
         &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
             &lt;span style=&quot;color: white;&quot;&gt;_instance&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton();&lt;/span&gt;
         &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
         &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;_instance;&lt;/span&gt;
     &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Yes, we are done now. It&#39;s a singleton class now, with the only single instance is exposed globally for use.Now let&#39;s make a simple example to check that our singleton class is really working or not.In this example will try to make two make to an instance of the class and then compare both instance to see if they both are same or not.If both are same then it will return &lt;b&gt;&lt;i&gt;&quot;Singleton is applied&quot;&lt;/i&gt;&lt;/b&gt; otherwise &lt;i&gt;&lt;b&gt;&quot;Singleton is not applied&quot;&lt;/b&gt;&lt;/i&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Example:&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;s1&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton.Instance();&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;s2&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton.Instance();&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(s1&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;s2)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Singleton is appiled&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;else&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Singleton is not applied&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;_instance;&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;singleton&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Instance&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(_instance&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;_instance&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;singleton();&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;_instance;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Output:&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIItuxEBAXxjoD3w7lqnFgDl_fQ_q3_3Jys7zWlP6PIES1gDRo6ObSYhbF3G540uyLFIZNGdG9mxZQqSH16eDGGthoAIhATxLJzCSoUm2pJINUX-6ollS9Zn4T94dMXgoO2BkbbuWmPZY/s1600/singleton+OP.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;326&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIItuxEBAXxjoD3w7lqnFgDl_fQ_q3_3Jys7zWlP6PIES1gDRo6ObSYhbF3G540uyLFIZNGdG9mxZQqSH16eDGGthoAIhATxLJzCSoUm2pJINUX-6ollS9Zn4T94dMXgoO2BkbbuWmPZY/s640/singleton+OP.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
It&#39;s done our singleton class is working as expected.In our next post, we will continue with one of the other remaining design patterns.If you have learned anything from our post please do comment, follow us on twitter and like our Facebook page.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoPlainText&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Body Footer Test --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;9971320340&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/4649315545978596107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/11/design-patterns-in-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4649315545978596107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4649315545978596107'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/11/design-patterns-in-c.html' title='Design Patterns in C#'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-1499018000099749173</id><published>2015-11-01T18:59:00.004+05:30</published><updated>2015-11-03T15:05:02.436+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# beginner"/><category scheme="http://www.blogger.com/atom/ns#" term="c# developer"/><category scheme="http://www.blogger.com/atom/ns#" term="c# programming"/><category scheme="http://www.blogger.com/atom/ns#" term="c# programming help"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><category scheme="http://www.blogger.com/atom/ns#" term="factorial in c#"/><category scheme="http://www.blogger.com/atom/ns#" term="learn to code c#"/><category scheme="http://www.blogger.com/atom/ns#" term="learning to code"/><category scheme="http://www.blogger.com/atom/ns#" term="uses of c# programming language"/><title type='text'>C# program to find factorial of number using goto loop.</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Introduction:&lt;/h3&gt;
In post related to the Factorial Program we have seen how to implement Factorial program using&lt;b&gt; &lt;a href=&quot;http://cfetch.blogspot.com/2015/10/c-program-to-find-factorial-of-number.html&quot;&gt;For Loop&lt;/a&gt;&lt;/b&gt; and &lt;a href=&quot;http://cfetch.blogspot.com/2015/10/c-program-to-find-factorial-of-number.html&quot;&gt;&lt;b&gt;Do-While Loop&lt;/b&gt;&lt;/a&gt;. Now in this post we are going to take a look on one interesting program in which &amp;nbsp;we will try to implement Factorial Program using&lt;b&gt; goto&lt;/b&gt; loop.It will be fun to implement this program once we are familiar to&lt;b&gt; goto&lt;/b&gt;. So before moving further we will check out what is &lt;b&gt;goto&lt;/b&gt;. &lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Background:&lt;/h3&gt;
&lt;div&gt;
Before implementing this program you must be &amp;nbsp;familiar with&lt;b&gt; goto loop&lt;/b&gt; and the concept of factorial.&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
goto:&amp;nbsp;&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
goto &lt;span style=&quot;font-weight: normal;&quot;&gt;is an unconditional jump statement in programming.It would &lt;/span&gt;jump&lt;span style=&quot;font-weight: normal;&quot;&gt; to particular location marked as label and then continue the &amp;nbsp;execution of &amp;nbsp;the program for there.We can use &lt;/span&gt;goto &lt;span style=&quot;font-weight: normal;&quot;&gt;where we want to skip some line of code and continue from some other location.But i would not advise the use of &lt;/span&gt;goto&lt;span style=&quot;font-weight: normal;&quot;&gt; in large programs, because it makes difficult to know the flow of program.&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Syntax:&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;goto&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;label;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;..........&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;..........&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;..........&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;label:statements;&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To know more follow the links:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Reference for goto: &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/13940fs2.aspx&quot;&gt;MSDN&lt;/a&gt; | &lt;a href=&quot;http://www.dotnetperls.com/goto&quot;&gt;DotNET Perls&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Factorial: &lt;a href=&quot;https://www.mathsisfun.com/numbers/factorial.html&quot;&gt;Math is Fun&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Implementation:&lt;/h4&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ConsoleApplication4&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter Number&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Convert.ToInt16(Console.ReadLine());&lt;/span&gt;

            &lt;span style=&quot;color: white;&quot;&gt;Factorial:&lt;/span&gt;
            

               &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i;&lt;/span&gt;
               &lt;span style=&quot;color: white;&quot;&gt;i=i-&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;

               &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(i!=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;goto&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Factorial;&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(fact);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Body Footer Test --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;9971320340&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/1499018000099749173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/11/c-program-to-find-factorial-of-number.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/1499018000099749173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/1499018000099749173'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/11/c-program-to-find-factorial-of-number.html' title='C# program to find factorial of number using goto loop.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-8367992696720766685</id><published>2015-10-31T12:23:00.002+05:30</published><updated>2015-10-31T16:04:04.030+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# beginner"/><category scheme="http://www.blogger.com/atom/ns#" term="C# Program to find Fibonacci Sequence"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><category scheme="http://www.blogger.com/atom/ns#" term="fibonacci number in c#"/><title type='text'>C# program to find the Fibonacci Sequence using recursion.</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
In our previous post we have discussed a lot of interesting thing about &amp;nbsp;Fibonacci Sequence and then implemented the program &amp;nbsp;to find the Fibonacci Sequence for the terms entered by the user,but the main thing is that we have created that program without recursion and in this post we are going to first take a bird view on recursion and then try to implement the program.So let&#39;s start with recursion.&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;Recursion:&lt;/h3&gt;
&lt;div&gt;
The simple meaning of recursion is the repeated application of any procedure.And if talk in context of programming then recursion is to call a method repeatedly or use call the function by itself.And we can&#39;t say that using of recursive call may always going to improve the performance.It depends on how the recursion call is made.Here in our program we are going to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Tail_call&quot;&gt;tail recursive call&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To know more about recursion follow the link : &lt;a href=&quot;http://cs-fundamentals.com/c-programming/recursion-in-c.php&quot;&gt;Recursion&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now let us move toward implementing our program using recursion.We are going to make a function named FibonacciFunction() and implement our logic in that function and make a self call.Logic is implemented in a way that if user enter 0 as input he will not get any out put.For 1 he will get 0 as output and for any other input result are calculated accordingly.Below is our final logic to implement Fibonacci Program using recursion in C#.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ConsoleApplication1&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;

            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;n,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter the number of terms:&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Convert.ToInt16(Console.ReadLine());&lt;/span&gt;

            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Fibonacci series\n&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
           
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(c&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;n;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c++)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;result&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;FibonacciFunction(i);&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;Console.Write(result&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;i++;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine();&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;FibonacciFunction&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;n)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(n&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(n&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;else&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(FibonacciFunction(n&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;FibonacciFunction(n&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Output:&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzz2UZURxPqGmGS47ztw073-PPJ42dVUDOpT6C-yK-ZFKATeAsq1nAXqKxO1SeHDAmzfdQkg8_3bh24scaQhir42BHrS_hwe68csSWAQYygh-gLJwPqXCIn5cHbUbdhH5BJHW17EzmGlg/s1600/Fib+Output.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzz2UZURxPqGmGS47ztw073-PPJ42dVUDOpT6C-yK-ZFKATeAsq1nAXqKxO1SeHDAmzfdQkg8_3bh24scaQhir42BHrS_hwe68csSWAQYygh-gLJwPqXCIn5cHbUbdhH5BJHW17EzmGlg/s640/Fib+Output.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here in this program implementing recursion may not going to improve the performance.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/8367992696720766685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-sharp-fibonacci-recursive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/8367992696720766685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/8367992696720766685'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-sharp-fibonacci-recursive.html' title='C# program to find the Fibonacci Sequence using recursion.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-225371746607716171</id><published>2015-10-30T23:14:00.001+05:30</published><updated>2015-10-31T14:02:39.574+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="c programming help"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# beginner"/><category scheme="http://www.blogger.com/atom/ns#" term="C# Program to find Fibonacci Sequence"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><category scheme="http://www.blogger.com/atom/ns#" term="fibonacci number in c#"/><category scheme="http://www.blogger.com/atom/ns#" term="Fibonacci Sequence"/><category scheme="http://www.blogger.com/atom/ns#" term="sequence of number"/><title type='text'>C# Program to find Fibonacci Sequence for the given number.</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
In this post today we are going to first take a look on what is Fibonacci Series and then try to implement C# program for finding the Fibonacci Sequence for a number.We will try to make implement this program without recursion and without recursion.&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Fibonacci Sequence :&lt;/h3&gt;
&lt;div&gt;
Fibonacci Sequence is name behind a Italian mathematician &lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci&quot;&gt;Fibonacci&lt;/a&gt;.The logic behind it so simple and it is quite easy to understand.In &amp;nbsp;Fibonacci Sequence every third number is sum&amp;nbsp;of the first two number. The starting point for the series may be 1 and 1 or 0 and 1 depending on &amp;nbsp;the selection of the starting point further series is calculated.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
One interesting thing about Fibonacci is that if we start making &amp;nbsp;squares corresponding to the number in the calculated Fibonacci Series and join the opposite angles, then you will get a spiral curve as show in below image.&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/AVvXsEh8KCrdKTUauU1pnybsvL0vJjEwQbSFa6S2olNxF0LL-vXzfNwdhq4Tt-OcRE9lfsrpG0gnhAlA1Q4ZRln2g3umLkLhpOzDFindXtdl_AP6oTwp9c38GAlHsPR1clSNLCsjKy2Nsf3X7bI/s1600/fibonacci-spiral.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;199&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8KCrdKTUauU1pnybsvL0vJjEwQbSFa6S2olNxF0LL-vXzfNwdhq4Tt-OcRE9lfsrpG0gnhAlA1Q4ZRln2g3umLkLhpOzDFindXtdl_AP6oTwp9c38GAlHsPR1clSNLCsjKy2Nsf3X7bI/s320/fibonacci-spiral.gif&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;Image From&amp;nbsp;https://www.mathsisfun.com&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Series starting with 0: 0,1,1,2,3,5,8,13,21...........&lt;/li&gt;
&lt;li&gt;Series starting with 1: 1,1,2,3,5,8,13,21,........&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
If you are interested to know more about Fibonacci Sequence Follow: &amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fibonacci_number&quot; style=&quot;text-align: center;&quot;&gt;Wikipedia&amp;nbsp;&lt;/a&gt;&lt;span style=&quot;text-align: center;&quot;&gt;&amp;nbsp; &amp;nbsp;| &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.mathsisfun.com/numbers/fibonacci-sequence.html&quot; style=&quot;text-align: center;&quot;&gt;Mathsisfun&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Now let us move towards making our Fibonacci Series generator console app. I guess that you are familiar of creating a new C# console application in visual studio.In our first app we are going to make a simple application which can find Fibonacci for the number entered by the user.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Let us first build the logic as we know we are going to add first two number in order to get the third one.Let&#39;s take three variables a,b,c.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
c=a+b;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Here c = Sum of two number,&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
a = First Number,&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
b = Second Number.&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
But now the question is what will be the value of &amp;nbsp;a and b.Here a and b will become our starting point we have to initialize them with 0 and 1 or 1 and 1 depending on our choice of starting point.Now to complete our logic we have to pass value of b to a and value of c to b and iterating it within the for loop.So our final logic will look like this.&lt;/div&gt;
&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Factorial [.net] --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;5736583940&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;h4 style=&quot;text-align: left;&quot;&gt;
1.Fibonacci Program without recursion&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ConsoleApplication3&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;a=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;b=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,no=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter number to print Fibonacci for:&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;no&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Convert.ToInt16(Console.ReadLine());&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;lt;=no;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i++)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(a);&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;c&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;b;&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;b;&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;b&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c;&lt;/span&gt;
                
            
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So in this post we have created Fibonacci Series program using simple for loop. In our next post we will implement this program using recursion.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/225371746607716171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-program-to-find-fibonacci-sequence.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/225371746607716171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/225371746607716171'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-program-to-find-fibonacci-sequence.html' title='C# Program to find Fibonacci Sequence for the given number.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-4978711849291857349</id><published>2015-10-25T13:52:00.000+05:30</published><updated>2015-11-03T15:00:01.502+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><category scheme="http://www.blogger.com/atom/ns#" term="flatten a  hierarchical collection of objects in Linq"/><category scheme="http://www.blogger.com/atom/ns#" term="linq"/><category scheme="http://www.blogger.com/atom/ns#" term="multilevel droupdown menu in linq"/><category scheme="http://www.blogger.com/atom/ns#" term="multilevel menu"/><title type='text'>Create a multilevel menu in linq .</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
In this post we will see how to generate a multilevel menu in Linq or we can as flatten a &amp;nbsp;hierarchical collection of objects in Linq. For that purpose we are going to make new C# console application.we will design this application such that root node will follow the below shown &amp;nbsp;pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Root Node Name ( Count Of Child Node)Is Child of(Parent Node)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Child Node Name 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Child Node Name 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...........&lt;br /&gt;
&lt;br /&gt;
Now lets us first of all add two classes to our application to our application.This two class will be &lt;b&gt;Menu &lt;/b&gt;and&amp;nbsp;&lt;b&gt;MenuItem&amp;nbsp;&lt;/b&gt;.&amp;nbsp;MenuItem&amp;nbsp;class will have properties like id,name,list of children and a parent node to&amp;nbsp;track its root node. Menu class will have properties like id, name and a nullable parent id, because a root node may or may not have any root node.Below i have show the code for Menu and Menuitem class.
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
1.Menu Class&lt;/h3&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int?&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ParentID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Menu&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;id,&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;name,&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int?&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;parentID)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;id;&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;name;&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.ParentID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;parentID;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
2.Menuitem Class&lt;/h3&gt;
&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6
7&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;IList&amp;lt;MenuItem&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Children&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Patent&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now let us move towards the next step of creating a multilevel menu.so far we have created two classes named Menu and&amp;nbsp;MenuItem&amp;nbsp;.Now it&#39;s time to adding content to our menu.I have added members to the&amp;nbsp;menu so that i can get the output as show in below image.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_mbeuCiY8_jUSnAiLcprXniei-VQ6gqONPH_E8s3UTCGli-TRqLnVs6XludsiLtsV7bJ4kN8ETjWv5Imh3QMHyebkdTRnMXmI3Zzokw9hlguUjUK8qAGgMEXlc27dm7oCgi6cPI46628/s1600/Updated+Output.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_mbeuCiY8_jUSnAiLcprXniei-VQ6gqONPH_E8s3UTCGli-TRqLnVs6XludsiLtsV7bJ4kN8ETjWv5Imh3QMHyebkdTRnMXmI3Zzokw9hlguUjUK8qAGgMEXlc27dm7oCgi6cPI46628/s640/Updated+Output.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
3.Code To Add Menu Members&lt;/h3&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; &lt;span style=&quot;color: white;&quot;&gt;List&amp;lt;Menu&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menus&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;List&amp;lt;Menu&amp;gt;();&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 0&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2.3&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.1.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;11&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.2.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 3&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;13&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 3.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As you can see i have created a list of type Menu and then using menu.Add() i have added member to list according to my requirement.This menu will have 3 root level and each root level have one or two children. The count of child will be shown beside the root node as shown in the above figure.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now let us move towards the most important step of this code and that is the code to flatten this hierarchical menu using linq. Firstly we are going to use SQL like syntax to write the code and then we will convert it to lamda expression.You can use any of the code to generate your menu.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Factorial [.net] --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-client=&quot;ca-pub-1131091548916078&quot;
     data-ad-slot=&quot;5736583940&quot;
     data-ad-format=&quot;auto&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
4.SQL Like Query Expression &amp;nbsp;&amp;nbsp;&lt;/h3&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;IList&amp;lt;MenuItem&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;GenerateTree(IEnumerable&amp;lt;Menu&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;collection,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;rootItem)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;IList&amp;lt;MenuItem&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;lst&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;List&amp;lt;MenuItem&amp;gt;();&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(Menu&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;collection.Where(c&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c.ParentID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;rootItem.ID))&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;lst.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c.ID,&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c.Name,&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;Parent&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem()&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ID=rootItem.ID,Name=rootItem.Name},&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;Children&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;GenerateTree(collection,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c)&lt;/span&gt;

                &lt;span style=&quot;color: white;&quot;&gt;});&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;lst;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
So for creating our multilevel menu i have created a function named GenerateTree() with return &amp;nbsp;type List&amp;lt;MenuItem&amp;gt;.If we talk about the working of this function it will accept two parameters &lt;b style=&quot;font-style: italic;&quot;&gt;Collection of Menu &lt;/b&gt;and&lt;b style=&quot;font-style: italic;&quot;&gt;&amp;nbsp; rootItem . &lt;/b&gt;Inside that we are going to create a new list of children for that root item and add it to that MenuItem list.Here it may happen that the children may have children.To achieve we have to make a recursive call to our GenerateTree() function.Which i have stored in Children.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
5.Printing the Menu&lt;/h3&gt;
&lt;div&gt;
Now we have generated the menu according to our requirement,it&#39;s time to print it.For that i am going to create a new function named PrintTree()&amp;nbsp;and passing &lt;b&gt;menuitems&lt;/b&gt; and a &lt;b&gt;tab space&lt;/b&gt; as parameter.It will also be a recursive function as shown below.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;PrintTree&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(MenuItem&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems,&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;tab)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(tab&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems.Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;({0})&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt;
                             &lt;span style=&quot;color: white;&quot;&gt;menuItems.Children.Count)&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Is Child of &quot;&lt;/span&gt;
                             &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;({0})&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems.Parent.Name));&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems.Children)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;PrintTree(item,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;tab&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
6.Calling the Functions&lt;/h3&gt;
&lt;div&gt;
Now let&#39;s move towards the last step in which we are going to make a call to this two above created function from our main method.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;result&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;GenerateTree(menus,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menus.First());&lt;/span&gt;

            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;result)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;PrintTree(item,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
7.Final Code&lt;/h3&gt;
&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MultiLevelAdvanced&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;List&amp;lt;Menu&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menus&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;List&amp;lt;Menu&amp;gt;();&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 0&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 1.2.3&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.1.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;11&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 2.2.2&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 3&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;menus.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;13&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Level 3.1&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;));&lt;/span&gt;

            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;result&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;GenerateTree(menus,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menus.First());&lt;/span&gt;

            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;result)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;PrintTree(item,&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

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

        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;PrintTree&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(MenuItem&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems,&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;tab)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(tab&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems.Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;({0})&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt; 
            &lt;span style=&quot;color: white;&quot;&gt;menuItems.Children.Count));&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;menuItems.Children)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;PrintTree(item,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;tab&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;\t&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;IList&amp;lt;MenuItem&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;GenerateTree(IEnumerable&amp;lt;Menu&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;collection,&lt;/span&gt; 
         &lt;span style=&quot;color: white;&quot;&gt;Menu&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;rootItem)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;IList&amp;lt;MenuItem&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;lst&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;List&amp;lt;MenuItem&amp;gt;();&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(Menu&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;collection.Where(c&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c.ParentID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;rootItem.ID))&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;lst.Add(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c.ID,&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c.Name,&lt;/span&gt;
                    &lt;span style=&quot;color: white;&quot;&gt;Children&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;GenerateTree(collection,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;c)&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;});&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;lst;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;IList&amp;lt;MenuItem&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Children&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MenuItem&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Patent&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Menu&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int?&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ParentID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;

        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Menu&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;id,&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;name,&lt;/span&gt; &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int?&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;parentID)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.ID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;id;&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.Name&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;name;&lt;/span&gt;
            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.ParentID&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;parentID;&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Bingo!!! it&#39;s done we have created a multilevel menu using linq sql like query expression in our next post we will edit our code according to lamda expression.If you have learnt some thing from thing article please vote up this article on Code Project.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.codeproject.com/Tips/1041156/Create-a-multilevel-menu-in-linq-Part&quot;&gt;&lt;b&gt;Article at Code Project&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/4978711849291857349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/create-multilevel-menu-in-linq-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4978711849291857349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4978711849291857349'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/create-multilevel-menu-in-linq-part-1.html' title='Create a multilevel menu in linq .'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-5111737944588595145</id><published>2015-10-22T17:32:00.000+05:30</published><updated>2015-10-30T23:00:09.579+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# beginner"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="do-while loop"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><category scheme="http://www.blogger.com/atom/ns#" term="factorial in c#"/><category scheme="http://www.blogger.com/atom/ns#" term="Factorial using do-while loop"/><category scheme="http://www.blogger.com/atom/ns#" term="Factorial using for loop"/><category scheme="http://www.blogger.com/atom/ns#" term="for loop"/><title type='text'>C# Program to find Factorial of a number</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
In this post today we are going to see two different program in first program we are going to find factorial of a number using for loop and in the other program &amp;nbsp;we are going to find the factorial using do-while &amp;nbsp;loop.And it will be a console application which accept a number from the user and give the factorial of number as &amp;nbsp;output.&lt;br /&gt;
&lt;br /&gt;
Before moving to actually making our factorial console application, let us take look on the two looping statements which we are going to use in our application&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
1.For Loop (Entry Control Loop)&lt;/h3&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(init;condition;increment)&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
   &lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//statements to be executed.&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
Here&lt;b&gt; init&lt;/b&gt; is the initialization part of thee for loop where you can initialize the variable. which your age going to use at any &amp;nbsp;value according to your requirement or we can say that the loop will start from that point.Init will be checked once we the loop start execution.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Condition&lt;/b&gt; &amp;nbsp;is the part which &amp;nbsp;will be checked to enter the for loop.If the condition is satisfied then and only then the statements inside the for loop are executed.Otherwise the statements are skipped.&lt;br /&gt;
&lt;br /&gt;
After the control statements executed the control jump back to &amp;nbsp;&lt;b&gt;increment&lt;/b&gt; to update loop control variables.&lt;br /&gt;
Check More on Foor Loop:&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/c_for_loop.htm&quot;&gt;&lt;button&gt; Know More..&lt;/button&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
2.Do-While Loop (Exit Control Loop)&lt;/h3&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//statements&lt;/span&gt;
      &lt;span style=&quot;color: white;&quot;&gt;increment&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(Condition)&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
Here in do-while loop all the statements inside the loop are executed once and the condition is checked at the end of the loop.&lt;br /&gt;
Check More on Do-while Loop:&lt;a href=&quot;http://www.tutorialspoint.com/cprogramming/c_do_while_loop.htm&quot;&gt;&lt;button&gt; Know More..&lt;/button&gt;&lt;/a&gt;&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Factorial Post Body --&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- Factorial [.net] --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-1131091548916078&quot; data-ad-format=&quot;auto&quot; data-ad-slot=&quot;5736583940&quot; style=&quot;display: block;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;br /&gt;
Now let&#39;s move towards making our console application.Select the new console application under Visual C#.You can name it what ever you like, i&#39;m going to name it &quot;Factorial App&quot;.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHnYYShms18oAShP5NRj3FKb4-W9IVSFgpfc8AV9Uz4sH0XmP86yAQcgYgPdNvVet_XcZhDeh4-9LJT_yBUM9hRGZeI99c-KnRLRV6JtisFB8p6HpL0X89x6ygyR6I4JJnVCHh_Uq-meo/s1600/Factorial+Post.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHnYYShms18oAShP5NRj3FKb4-W9IVSFgpfc8AV9Uz4sH0XmP86yAQcgYgPdNvVet_XcZhDeh4-9LJT_yBUM9hRGZeI99c-KnRLRV6JtisFB8p6HpL0X89x6ygyR6I4JJnVCHh_Uq-meo/s640/Factorial+Post.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now there is no need to add any extra name space.You can just start writing program in &amp;nbsp; the main method.First we are going to make program &amp;nbsp;using for loop.&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Using For Loop:&lt;/h3&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ConsoleApplication1&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter Number&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Convert.ToInt16(Console.ReadLine());&lt;/span&gt;

            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;do&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;

                &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i;&lt;/span&gt;
                &lt;span style=&quot;color: white;&quot;&gt;i--;&lt;/span&gt;

            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;

        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Using Do-while loop:&lt;/h3&gt;
&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Linq;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Text;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Threading.Tasks;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;ConsoleApplication2&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter Number&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Convert.ToInt16(Console.ReadLine());&lt;/span&gt;

            &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;j&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;j&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i;j++&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;)&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;

                &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;fact&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i;&lt;/span&gt;

            &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt; 
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Download options:&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.mediafire.com/view/i5g2jkratkdse7d/cfetch.blogspot.in-C_Program_to_find_Factorial_of_a_number.pdf&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiztskWv49MTv4FQ11LBQSd4ktLmlQB9YD5hZOro1vbVTRKP78vPffnCtb5DF-wMiXC2t7awih1cdHIDJFr0VGV2GLqbidP5nc6WBOlY5yang6n0LKCUZeeUhFvheIV1jTj0EwhCocyW0w/s1600/PDF+Dload.png&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;
&lt;h3 style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Code Download:&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.Using For loop: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.mediafire.com/download/gpsto8b5aspaa96/ConsoleApplication1-2015-10-22.zip&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9rx39svPzIeV_x8DYBfA4YWvjOBEjP-g5lRdXpZSRaO43oH5CqHxTnT75Lsn6Lr9lugOdPXjDmVPaSDhIIv5uO4ygEgg0XMi87OHP9v_v4fv53RhlkDetROx-OszIaFPMzql4EIVZHek/s1600/Code+Dload.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.Using Do-while loop&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.mediafire.com/download/jdojpahr7pfqbq7/ConsoleApplication2-2015-10-22.zip&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9rx39svPzIeV_x8DYBfA4YWvjOBEjP-g5lRdXpZSRaO43oH5CqHxTnT75Lsn6Lr9lugOdPXjDmVPaSDhIIv5uO4ygEgg0XMi87OHP9v_v4fv53RhlkDetROx-OszIaFPMzql4EIVZHek/s1600/Code+Dload.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/5111737944588595145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-program-to-find-factorial-of-number.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5111737944588595145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5111737944588595145'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-program-to-find-factorial-of-number.html' title='C# Program to find Factorial of a number'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-7158113751952762255</id><published>2015-10-18T18:41:00.000+05:30</published><updated>2015-10-24T22:58:04.588+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="classes"/><category scheme="http://www.blogger.com/atom/ns#" term="classes java"/><category scheme="http://www.blogger.com/atom/ns#" term="inheritance"/><category scheme="http://www.blogger.com/atom/ns#" term="interface"/><category scheme="http://www.blogger.com/atom/ns#" term="java classes"/><category scheme="http://www.blogger.com/atom/ns#" term="java classes tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="java crash course"/><category scheme="http://www.blogger.com/atom/ns#" term="java online course"/><category scheme="http://www.blogger.com/atom/ns#" term="Java Programs"/><category scheme="http://www.blogger.com/atom/ns#" term="java tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript classes"/><category scheme="http://www.blogger.com/atom/ns#" term="runtime polymorphism"/><title type='text'>Notes on classes and types of classes with runtime polymorphism example.</title><content type='html'>&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/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s1600/Java+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s1600/Java+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
In this post we will learn about types of classes in java with examples. In this example we will develop runtime polymorphism&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Class:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
A class is a top level block that is used for grouping variables and methods for developing logic.&lt;br /&gt;
&lt;br /&gt;
Types of classes;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 1) Interface&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 2) Abstract class&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 3) Concrete class&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 4) Final class&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 5) Enum&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;1) Interface;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
It is fully unimplemented class used for declaring a set of operations of an object. It contains only public static final variables and public abstract methods. It is always created as root class. Interface tells what should implement but not how.&lt;br /&gt;
&lt;br /&gt;
Let us consider an vehicle example, here we will create vehicle interface which tells what should we implement.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//Vehicle.java&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Vehicle&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
       &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;();&lt;/span&gt;
       &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;breaks&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;();&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;2) Abstract &amp;nbsp;class:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;It is partially implemented class used for developing some of the operations of an object. Abstract class is next level subclass. So it contains abstract methods, concrete methods including variables, blocks and constructors. It is always created as superclass next to interface.&lt;br /&gt;
&lt;br /&gt;
In above we created vehicle as interface. So now here we will create bus, car, bike as abstract class, because we have different types of buses, cars, bikes with some common operarions and individual operations.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6
7
8&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//Bus.java&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Bus&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;implements&lt;/span&gt;  &lt;span style=&quot;color: white;&quot;&gt;Vehicles&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
      &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;breaks&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
      &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;System.&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Bus has two breaks&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
      &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
At bus level the method breaks() can only be implemented because it is common for all buses subclasses. The method engine() will be implemented in subclasses. So this class must be declared as abstract.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;3) Concrete class;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;It is fully implemented class used for implementing all operations &amp;nbsp;of an object. It contains only concrete methods including variables, blocks and constructor. It is always created as subclass next to abstract class or interface in objects inheritance hierarchy.&lt;br /&gt;
&lt;br /&gt;
In above we created Vehicle as interface and bus as abstract class which implements vehicle interface. So now here we will create RedBus, Volvo as concrete class by implementing all other operations which are left as abstract in its superclass(Bus.java).&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//RedBus.java&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;RedBus&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Bus&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;System.&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;RedBus engine capacity is 40 kmph&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//Volvo.java&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Volvo&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Bus&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;System.&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Volvo engine capacity is 100 kmph&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
So now develop a runtime polymorpic class to use all Vehicles operations&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//Driver.java&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Driver&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;assignVehicle&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(Vehicle&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;v)&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;v.engine();&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;v.breaks();&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;background-color: #0f140f; color: #008800; font-style: italic;&quot;&gt;//Depo.java&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Depo&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(String[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;Driver&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;driver1=&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Driver();&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;driver1.assignVehicle(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Volvo());&lt;/span&gt;
  
                &lt;span style=&quot;color: white;&quot;&gt;System.&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;.println(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;-------------------------------&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;

   &lt;span style=&quot;color: white;&quot;&gt;Driver&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;driver2=&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Driver();&lt;/span&gt;
  &lt;span style=&quot;color: white;&quot;&gt;driver1.assignVehicle(&lt;/span&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Volvo());&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
After running the appication output will be,&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0hSSd-M3Zqe3cuwumTm9s83jHb5U-oNBTwBmqPISxOnluselqUAaAaKWQyaUVXIKFzkm6SMRAoB7WjhwGyP7GYz_3pPPJWNqsQtnwB12FfmjWIhjhbVV6zNTL4uRBZR-ocKNfqLxO4_0X/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;155&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0hSSd-M3Zqe3cuwumTm9s83jHb5U-oNBTwBmqPISxOnluselqUAaAaKWQyaUVXIKFzkm6SMRAoB7WjhwGyP7GYz_3pPPJWNqsQtnwB12FfmjWIhjhbVV6zNTL4uRBZR-ocKNfqLxO4_0X/s400/Capture.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;NOTE&lt;/u&gt;&lt;/b&gt;: If you want the above program in c#.net then visit&amp;nbsp;&lt;a href=&quot;http://csharphy.blogspot.in/&quot;&gt;http://csharphy.blogspot.in/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Download Option:&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.mediafire.com/view/3r5zambutm96dr6/cfetch.blogspot.com-Notes_on_classes_and_types_of_classes_with_runtime_polymorphism_example.pdf&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiztskWv49MTv4FQ11LBQSd4ktLmlQB9YD5hZOro1vbVTRKP78vPffnCtb5DF-wMiXC2t7awih1cdHIDJFr0VGV2GLqbidP5nc6WBOlY5yang6n0LKCUZeeUhFvheIV1jTj0EwhCocyW0w/s1600/PDF+Dload.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/7158113751952762255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/notes-on-classes-and-types-of-classes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7158113751952762255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7158113751952762255'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/notes-on-classes-and-types-of-classes.html' title='Notes on classes and types of classes with runtime polymorphism example.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s72-c/Java+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-5426935202949281124</id><published>2015-10-17T01:41:00.001+05:30</published><updated>2015-10-21T22:15:32.913+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><category scheme="http://www.blogger.com/atom/ns#" term="Generics"/><title type='text'>Program to Add any two types using Generics.</title><content type='html'>&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/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s1600/Bannernet.png&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;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;This program is used to perform addition between any two types or concat between two strings using single method with Generics.&lt;/span&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;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table style=&quot;border: 0px;&quot;&gt;&lt;tbody style=&quot;border: 0px;&quot;&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;System.Collections.Generic;&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Generics&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;MyClass&amp;lt;T&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;T&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;a;&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;T&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;b;&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(T&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i,T&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;j)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;b&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;j;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(i.GetType());&lt;/span&gt;      
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;test1&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Add&amp;lt;T&amp;gt;(T&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;a,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;T&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;b)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;dynamic&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;a;&lt;/span&gt;
            &lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;dynamic&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;j&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;b;&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;Console.WriteLine(i+j);&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
     
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Program&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;Main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;args)&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;test1&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;t&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;test1();&lt;/span&gt;
         
            &lt;span style=&quot;color: white;&quot;&gt;t.Add&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: white;&quot;&gt;t.Add&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;tushar&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot; patel&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #93c47d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #93c47d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Note:Here in the add method we have declared variables i and j as dynamic because &lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;their types are not known at compile time and are inferred at run time.And an dynamic variable &lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;can change it&#39;s type at run time.&lt;/span&gt;

&lt;span style=&quot;color: white;&quot;&gt;Ex.     dynamic i =100;&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;        In this case i will initialized to 100 so it will be int32 type.But in case at run time &lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;        a string is assigned to it then it will become string type&lt;/span&gt;

&lt;span style=&quot;color: white;&quot;&gt;        And if we talk about usage of dynamic, it is mostly used to make properties and return &lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;        value from function &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;To know more follow the link : &lt;a href=&quot;http://www.c-sharpcorner.com/UploadFile/b1df45/var-vs-dynamic-keywords-in-C-Sharp/&quot;&gt;Dynamic Variables&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/5426935202949281124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/program-to-add-any-two-types-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5426935202949281124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5426935202949281124'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/program-to-add-any-two-types-using.html' title='Program to Add any two types using Generics.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGbdlaUMh_QHh_nxUu89K7WvUtP7wMA2RytcSSFmNZtlMqthYvo1XsgspyetvrVA05qfw5om2yFy1CgkhC4UvRoyf8xRdD7hme2iGsyNdf0L6vGNDtq7Acq6xAPThyiEtXkNMZW0XCFc/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-4583312538106101037</id><published>2015-10-16T22:17:00.001+05:30</published><updated>2015-10-19T10:22:46.181+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="C#.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Dot Net"/><title type='text'>C# Program To Find Total Number of Odd And Even Numbers From An Array.</title><content type='html'>&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/AVvXsEihgCTd_bXHHF2ntJZuykR3MeA5dFpAI7NzOA_UEAsRJexSDjBWnsDLyvz3OA3cixqzrK2b5EeNiUyU4ggh1uQnIpfV_iBpdsIrK6MYcY5wsK8by97r_rsUPeuNFkWkOW5D08y228doo9Y/s1600/Bannernet.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihgCTd_bXHHF2ntJZuykR3MeA5dFpAI7NzOA_UEAsRJexSDjBWnsDLyvz3OA3cixqzrK2b5EeNiUyU4ggh1uQnIpfV_iBpdsIrK6MYcY5wsK8by97r_rsUPeuNFkWkOW5D08y228doo9Y/s1600/Bannernet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading.Tasks;&lt;br /&gt;
&lt;br /&gt;
namespace ConsoleApplication10&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; class Program&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static void Main(string[] args)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int[] arr = new int[5];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int ocount = 0, ecount = 0;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Enter Array Values&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; 5; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; arr[i] = Convert.ToInt16(Console.ReadLine());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; 5; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (arr[i]%2==0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ecount++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ocount++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Total Even Numbers:&quot; + ecount);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Total Odd Numbers:&quot; + ocount);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.ReadLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/4583312538106101037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-program-to-find-total-number-of-odd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4583312538106101037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4583312538106101037'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/10/c-program-to-find-total-number-of-odd.html' title='C# Program To Find Total Number of Odd And Even Numbers From An Array.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihgCTd_bXHHF2ntJZuykR3MeA5dFpAI7NzOA_UEAsRJexSDjBWnsDLyvz3OA3cixqzrK2b5EeNiUyU4ggh1uQnIpfV_iBpdsIrK6MYcY5wsK8by97r_rsUPeuNFkWkOW5D08y228doo9Y/s72-c/Bannernet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-4654779486639812074</id><published>2015-06-23T18:46:00.000+05:30</published><updated>2015-10-22T10:50:20.257+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Star Pattern"/><title type='text'>Star Pattern-4</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
*****&lt;br /&gt;
&amp;nbsp; ****&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ***&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; **&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr style=&quot;border: 0px;&quot;&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #0f140f; color: #ff0007; font-style: italic; font-weight: bold;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #0f140f; color: #ff0007; font-style: italic; font-weight: bold;&quot;&gt;#include&amp;lt;conio.h&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; 
&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;i,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;j,&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;k,n;&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;Enter no. of rows for which you want to print*: \n&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;scanf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;%d&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;,&amp;amp;n);&lt;/span&gt; 
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(i=n;i&amp;gt;=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;i--)&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; 
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(j=n;j&amp;gt;=i;j--)&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt; 
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(k=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;k&amp;lt;=i;k++)&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt; 
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;&lt;/span&gt; 
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/4654779486639812074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4654779486639812074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/4654779486639812074'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-4.html' title='Star Pattern-4'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s72-c/C+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-695845611059709812</id><published>2015-06-22T21:44:00.000+05:30</published><updated>2015-10-22T11:55:03.582+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Star Pattern"/><title type='text'>Star Pattern-3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&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/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
*****&lt;br /&gt;
&amp;nbsp; ****&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ***&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; **&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #111111; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13&lt;/pre&gt;
&lt;/td&gt;&lt;td style=&quot;border: 0px;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #0f140f; color: #ff0007; font-style: italic; font-weight: bold;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: #cdcaa9; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;r,c;&lt;/span&gt;
&lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(r=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;r&amp;gt;=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;r--)&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: #fb660a; font-weight: bold;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;(c=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;;c&amp;lt;=r;c++)&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;);&lt;/span&gt;
 &lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: white;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Download Options:&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://www.mediafire.com/?p667h9s5ssiuisl&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;45&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh11bHZOld5O1RcscV0gyrM29u5bmCyoT4MvQzWtIowwJ01VEdrLlqSyM7hXvUI_tjaiVYLzdStrB5zN-vzidI-4ayLkZaB4eqGi_iKIgqDkVZG3ccvaOKW_xhowv7oVjC9FjGxL2F2Mmk/s200/Code+Dload.png&quot; style=&quot;text-align: center;&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/view/0sdf6ww5t2azkv0/cfetch.blogspot.in-Star_Pattern-3.pdf&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiluhplDqC2fm_CTWBdrL1ENkln27hIPGs2BAwJNqcUYSFv5VH14KAuTNTbrCppjCv_xz5Ybw9jYuGplUjF1EC7-OtkT4-jUh27dAmIHpoaqxzwzeSsQgvvVAxqySY6pwhO1ueCYnyjT9w/s1600/PDF+Dload.png&quot; /&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/695845611059709812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/695845611059709812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/695845611059709812'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-3.html' title='Star Pattern-3'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s72-c/C+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-288713714982219</id><published>2015-06-22T05:42:00.000+05:30</published><updated>2015-10-22T11:17:00.925+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Star Pattern"/><title type='text'>Star Pattern-2</title><content type='html'>&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/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;**&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp;***&lt;br /&gt;
&amp;nbsp;****&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; int i, j, k,n;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; printf(&quot;Enter no. of rows for which you want to print*: \n&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;n);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for(i=n;i&amp;gt;=1;i--)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(j=1;j&amp;lt;i;j++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot; &quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(k=n;k&amp;gt;=i;k--)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;*&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&quot;\n&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return 0;&lt;br /&gt;
}&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/288713714982219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/288713714982219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/288713714982219'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-2.html' title='Star Pattern-2'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s72-c/C+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-7446669502004974188</id><published>2015-06-21T19:29:00.000+05:30</published><updated>2015-10-22T11:18:55.517+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Programs"/><category scheme="http://www.blogger.com/atom/ns#" term="Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="Star Pattern"/><title type='text'>Star Pattern-1</title><content type='html'>&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/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
*&lt;br /&gt;
**&lt;br /&gt;
***&lt;br /&gt;
****&lt;br /&gt;
*****&lt;br /&gt;
&lt;br /&gt;
Program:&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #111111; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;border:0px;&quot;&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19&lt;/pre&gt;&lt;/td&gt;&lt;td style=&quot;border:0px;&quot;&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #ff0007; font-weight: bold; font-style: italic; background-color: #0f140f&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #ff0007; font-weight: bold; font-style: italic; background-color: #0f140f&quot;&gt;#include&amp;lt;conio.h&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #cdcaa9; font-weight: bold&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #ff0086; font-weight: bold&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;()&lt;/span&gt;
&lt;span style=&quot;color: #ffffff&quot;&gt;{&lt;/span&gt;
 &lt;span style=&quot;color: #cdcaa9; font-weight: bold&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #ffffff&quot;&gt;r,c,n;&lt;/span&gt;
&lt;span style=&quot;color: #ffffff&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2&quot;&gt;&amp;quot;Enter the number of rows for which you want to print *:&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;);&lt;/span&gt;
&lt;span style=&quot;color: #ffffff&quot;&gt;scanf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2&quot;&gt;&amp;quot;%d&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;,n);&lt;/span&gt;

&lt;span style=&quot;color: #fb660a; font-weight: bold&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;(r=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;;r&amp;lt;=n;r++)&lt;/span&gt;
     &lt;span style=&quot;color: #ffffff&quot;&gt;{&lt;/span&gt;
      &lt;span style=&quot;color: #fb660a; font-weight: bold&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;(c=&lt;/span&gt;&lt;span style=&quot;color: #0086f7; font-weight: bold&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;;c&amp;lt;=r;c++)&lt;/span&gt;
           &lt;span style=&quot;color: #ffffff&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #ffffff&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;);&lt;/span&gt;
            &lt;span style=&quot;color: #ffffff&quot;&gt;}&lt;/span&gt;
      &lt;span style=&quot;color: #ffffff&quot;&gt;printf(&lt;/span&gt;&lt;span style=&quot;color: #0086d2&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #ffffff&quot;&gt;);&lt;/span&gt;
     &lt;span style=&quot;color: #ffffff&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #ffffff&quot;&gt;getch();&lt;/span&gt;
&lt;span style=&quot;color: #ffffff&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/7446669502004974188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7446669502004974188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7446669502004974188'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/06/star-pattern-1.html' title='Star Pattern-1'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s72-c/C+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-6718962674412587140</id><published>2015-04-15T11:43:00.000+05:30</published><updated>2015-04-15T11:45:08.397+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Video Tutorials"/><title type='text'> Learn C Programming-02-Use of printf() to print in C console</title><content type='html'>&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/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hey Guy&#39;s!!!! Welcome to your 2nd C programming tutorial with Parth Patel.&lt;br /&gt;
In this tutorial we are going to take a look on printf() function,which is used to print anything in C console.Here in this tutorial we are going to print &quot;Hello World&quot; using printf() in C console..&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/K4e1PBMBMPE/0.jpg&quot; frameborder=&quot;0&quot; height=&quot;266&quot; src=&quot;http://www.youtube.com/embed/K4e1PBMBMPE?feature=player_embedded&quot; width=&quot;320&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/6718962674412587140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/04/guys-welcome-to-your-2nd-c-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/6718962674412587140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/6718962674412587140'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/04/guys-welcome-to-your-2nd-c-programming.html' title=' Learn C Programming-02-Use of printf() to print in C console'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s72-c/Video+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-6809738666700076999</id><published>2015-02-09T15:30:00.000+05:30</published><updated>2015-02-09T15:30:34.699+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Python Script to start the recording using Picamara in Rasoberry Pi</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hii guys....&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Today I&#39;m going to write a python script to start the video recording in Picamera Using RaspberryPi..&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For that You the following equpiment You need to integtare with raspberry pi..&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;PiCamera Connected to raspberry pi&lt;/li&gt;
&lt;li&gt;Pir Sensor module connected to GPIO Pin &amp;nbsp;to raspbeery Pi&lt;/li&gt;
&lt;li&gt;5V Rapberry Pi Charger&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now, Here I am going to write the python script to start recording :&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
import RPi.GPIO as GPIO&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
import time&lt;/div&gt;
&lt;div&gt;
import picamera&lt;/div&gt;
&lt;div&gt;
import datetime &amp;nbsp;# new&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
def get_file_name(): &amp;nbsp;# new&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; return datetime.datetime.now().strftime(&quot;%Y-%m-%d_%H.%M.%S.h264&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
sensor = 4&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
GPIO.setmode(GPIO.BCM)&lt;/div&gt;
&lt;div&gt;
GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
previous_state = False&lt;/div&gt;
&lt;div&gt;
current_state = False&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
cam = picamera.PiCamera()&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
while True:&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; time.sleep(0.1)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; previous_state = current_state&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; current_state = GPIO.input(sensor)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; if current_state != previous_state:&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new_state = &quot;HIGH&quot; if current_state else &quot;LOW&quot;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(&quot;GPIO pin %s is %s&quot; % (sensor, new_state))&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if current_state:&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fileName = get_file_name() &amp;nbsp;# new&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam.start_preview()&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam.start_recording(fileName) &amp;nbsp;# new&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else:&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam.stop_preview()&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam.stop_recording() &amp;nbsp;# new&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
by Executing this program You will get the .H264 Video file, which will save in the same folder of your python script. This file shows date as a file name..&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/6809738666700076999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/02/python-script-to-start-recording-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/6809738666700076999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/6809738666700076999'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/02/python-script-to-start-recording-using.html' title='Python Script to start the recording using Picamara in Rasoberry Pi'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-3253715398001108159</id><published>2015-01-25T16:30:00.000+05:30</published><updated>2015-02-02T22:46:20.108+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Video Tutorials"/><title type='text'>Learning C Programming-01-Installing Turbo C Editor</title><content type='html'>&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/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&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;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/5Dnk1FnZGAE?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Hey Guy&#39;s!!!&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Welcome to your 1&#39;st C programming Tutorial with Parth.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
In this tutorial i have shown a step by step procedure to install Turbo C Editor in our laptop or desktop.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Download Link:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
1. http://goo.gl/6hVygo&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
2. http://goo.gl/zeqNex&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
1. Download Turbo C Editor From the above link.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
2.Click on it and give permission to install. &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
3.Click Next.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
4.Click I Agree.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
5.Click Next.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
6.Click Finish.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
It&#39;s done guy&#39;s Turbo C Editor is ready to use.If u have any problem comment below.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/3253715398001108159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/learning-c-programming-01-installing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/3253715398001108159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/3253715398001108159'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/learning-c-programming-01-installing.html' title='Learning C Programming-01-Installing Turbo C Editor'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s72-c/Video+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-591001892305474363</id><published>2015-01-19T09:57:00.001+05:30</published><updated>2015-01-19T09:57:42.850+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Programs"/><title type='text'>Work of include directive in C/C++.</title><content type='html'>&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/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s1600/C+Banner.png&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;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
In this post we are going to understand what is include directive? And how it works? Also at the end of the post i had listed all the necessary header fil&lt;span style=&quot;font-family: inherit;&quot;&gt;es whic&lt;/span&gt;h are used in C/C++ programming.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;1. What is include directive?&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Many programming languages have a directive often called as &lt;b&gt;include &lt;/b&gt;(as well &lt;b&gt;copy&lt;/b&gt; or &lt;b&gt;import)&lt;/b&gt;&amp;nbsp;that causes the content of another file to be copied into the original file.This include files are also called as copybooks or header files.They are often used to define physical layout of a program and for forward deceleration.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Forward_declaration&quot;&gt;Forward deceleration&lt;/a&gt;&lt;/b&gt; is a deceleration of identifiers for which programmer has not yet given complete definition.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;2.Working of include directive.&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;There are two methods to include a file in a program as shown below:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;1. #include&amp;lt;header file name&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2. #include&quot;header file name&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;In&amp;nbsp;&lt;/span&gt;C&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;C++&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;, the #include&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;&amp;nbsp;&lt;/span&gt;preprocessor directive&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;&amp;nbsp;causes the&amp;nbsp;&lt;/span&gt;compiler&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;&amp;nbsp;to replace that line with the entire text of the contents of the named source file (if included in quotes: &quot;&quot;) or named header (if included in angle brackets: &amp;lt;&amp;gt;).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white; color: #252525; line-height: 22.3999996185303px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;3. List of C/C++ Header files.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cassert&amp;gt; (assert.h) &amp;nbsp; C Diagnostics Library (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cctype&amp;gt; (ctype.h) &amp;nbsp; &amp;nbsp;Character handling functions (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cerrno&amp;gt; (errno.h) &amp;nbsp; &amp;nbsp; C Errors (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cfenv&amp;gt; (fenv.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Floating-point environment (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cfloat&amp;gt; (float.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; Characteristics of floating-point types (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cinttypes&amp;gt; (inttypes.h) &amp;nbsp; C integer types (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;ciso646&amp;gt; (iso646.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; ISO 646 Alternative operator spellings (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;climits&amp;gt; (limits.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sizes of integral types (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;clocale&amp;gt; (locale.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C localization library (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cmath&amp;gt; (math.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C numerics library (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;csetjmp&amp;gt; (setjmp.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; Non local jumps (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;csignal&amp;gt; (signal.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C library to handle signals (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstdarg&amp;gt; (stdarg.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Variable arguments handling (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstdbool&amp;gt; (stdbool.h) &amp;nbsp; &amp;nbsp; Boolean type (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstddef&amp;gt; (stddef.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C Standard definitions (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstdint&amp;gt; (stdint.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Integer types (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstdio&amp;gt; (stdio.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C library to perform Input/Output operations (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstdlib&amp;gt; (stdlib.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C Standard General Utilities Library (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cstring&amp;gt; (string.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C Strings (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;ctgmath&amp;gt; (tgmath.h) &amp;nbsp; &amp;nbsp; &amp;nbsp;Type-generic math (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;ctime&amp;gt; (time.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C Time Library (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cuchar&amp;gt; (uchar.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Unicode characters (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cwchar&amp;gt; (wchar.h) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Wide characters (header)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;cwctype&amp;gt; (wctype.h) &amp;nbsp; &amp;nbsp; Wide character type (header)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/591001892305474363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/work-of-include-directive-in-cc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/591001892305474363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/591001892305474363'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/work-of-include-directive-in-cc.html' title='Work of include directive in C/C++.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAKw-9dKH9nmNqhU5hqpGZj8A7eIDu2T0j4DrCgGET7tgycYDMflh8ZlNS0C0WEyKRCbVBWULN015WsnQJzj6ndNVFoaaDi2BieEXf60s0CDzSGhjaPAMWMeh2OiBPOhZMw04wLBk9sM/s72-c/C+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-8754856563448829461</id><published>2015-01-17T09:45:00.000+05:30</published><updated>2015-01-17T09:52:12.076+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java Programs"/><title type='text'>A Java Program to Convert Celsius to Fahrenheit. </title><content type='html'>&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/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s1600/Java+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s1600/Java+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRoF3H8c1IGUGvrEznsdGukukUWrcAuoXkGobPEAcwxhWt8mQk0Tc8xcb92I3I_-jXSHbQVoyhLVsNp27i7UmhM8TpXSOSh4FMBG3di2qkQKahqrQKnt5V1tYX-Qt2PDqtaIBeayRGF-M/s1600/Temp+Convertor.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRoF3H8c1IGUGvrEznsdGukukUWrcAuoXkGobPEAcwxhWt8mQk0Tc8xcb92I3I_-jXSHbQVoyhLVsNp27i7UmhM8TpXSOSh4FMBG3di2qkQKahqrQKnt5V1tYX-Qt2PDqtaIBeayRGF-M/s1600/Temp+Convertor.png&quot; height=&quot;170&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Hey Guy&#39;s!!!!&lt;/div&gt;
&lt;br /&gt;
Welcome once again.It&#39;s Parth Patel here.In this tutorial we are going to make a Temperature converter which can convert&amp;nbsp;Celsius to Fahrenheit.In this program we are extending JFrame . For that we are going to use 2 Buttons,2 TextFields,2 Labels and 4 Panels.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
b1,b2----------2 Buttons&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
l1,l2---------- 2 Labels&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
t1,t2---------- 2 TextFields&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
p1,p2,p3,p4---------- 4 Panels&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
p1 is the main panel which is added into the center of border layout.And then p1&#39;s layout is set to grid layout of 3x1.Then p2,p3,p4 are added to p1 layout.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Let&#39;s start &amp;nbsp;Programming!!!!&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;/*&lt;/div&gt;
&amp;nbsp;* To change this template, choose Tools | Templates&lt;br /&gt;
&amp;nbsp;* and open the template in the editor.&lt;br /&gt;
&amp;nbsp;*/&lt;br /&gt;
&lt;br /&gt;
package temperatureconvertor;&lt;br /&gt;
&lt;br /&gt;
import java.awt.BorderLayout;&lt;br /&gt;
import java.awt.GridLayout;&lt;br /&gt;
import java.awt.event.ActionEvent;&lt;br /&gt;
import java.awt.event.ActionListener;&lt;br /&gt;
import javax.swing.JButton;&lt;br /&gt;
import javax.swing.JFrame;&lt;br /&gt;
import javax.swing.JLabel;&lt;br /&gt;
import javax.swing.JPanel;&lt;br /&gt;
import javax.swing.JTextField;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
&amp;nbsp;*&lt;br /&gt;
&amp;nbsp;* @author Parth&lt;br /&gt;
&amp;nbsp;*/&lt;br /&gt;
&lt;br /&gt;
class MyFrame extends JFrame implements ActionListener&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; JButton b1,b2;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; JLabel l1,l2;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; JPanel p1,p2,p3,p4;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; JTextField t1,t2;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; MyFrame()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; b1= new JButton(&quot;Convert&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; b2= new JButton(&quot;Reset&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; l1= new JLabel(&quot;Celsius&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; l2= new JLabel(&quot;Fahrenheit&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p1= new JPanel();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p2= new JPanel();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p3= new JPanel();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p4= new JPanel();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; t1= new JTextField(10);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; t2= new JTextField(10);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; add(p1,BorderLayout.CENTER);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p1.setLayout(new GridLayout(3,1));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p1.add(p2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p1.add(p3);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p1.add(p4);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p2.setLayout(new GridLayout(1,2));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p3.setLayout(new GridLayout(1,2));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p4.setLayout(new GridLayout(1,2));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p2.add(l1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p2.add(t1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p3.add(l2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p3.add(t2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p4.add(b1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; p4.add(b2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; b1.addActionListener(this);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; b2.addActionListener(this);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; t2.setEditable(false);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void actionPerformed(ActionEvent e) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String s = e.getActionCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(s.equals(&quot;Convert&quot;))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String s1=t1.getText();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n= Integer.parseInt(s1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; float f;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; f=32+(5*n)/9;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t2.setText(f+&quot;&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t1.setText(null);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t2.setText(null);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; throw new UnsupportedOperationException(&quot;Not supported yet.&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
class Demo&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;public static void main(String arg[])&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;MyFrame mf =new MyFrame();&lt;br /&gt;
&amp;nbsp;mf.setSize(300,150);&lt;br /&gt;
&amp;nbsp;mf.setVisible(true);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/8754856563448829461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-java-program-to-convert-celsius-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/8754856563448829461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/8754856563448829461'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-java-program-to-convert-celsius-to.html' title='A Java Program to Convert Celsius to Fahrenheit. '/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s72-c/Java+Banner.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-7509501134871856995</id><published>2015-01-13T16:41:00.001+05:30</published><updated>2015-01-13T16:41:57.714+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Video Tutorials"/><title type='text'>A Video tutorial to learn how to connect NetBeans IDE with Wamp Server.</title><content type='html'>&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/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/SNQLRSHtPPI?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
Hey Guys!!!&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Are u a programmer and having trouble in connecting a wamp server database with NetBeans IDE.Don&#39;t worry here is the solution in this video&lt;br /&gt;
&lt;br /&gt;
In this tutorial i have shown a step by step procedure to connect Wamp Server database with Netbeans IDE.If ou have any query comment below.I will help you with your problem.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/7509501134871856995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-video-tutorial-to-learn-how-to_13.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7509501134871856995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7509501134871856995'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-video-tutorial-to-learn-how-to_13.html' title='A Video tutorial to learn how to connect NetBeans IDE with Wamp Server.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s72-c/Video+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-5200821784303314442</id><published>2015-01-12T10:21:00.001+05:30</published><updated>2015-01-12T10:21:52.280+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java Programs"/><title type='text'>A Java Program to make a simple calculator.</title><content type='html'>&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/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s1600/Java+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s1600/Java+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHqJSTV7hEfZLwU0YusV-xwtPOGOH8CA3xAiFj2VZiRLJfrRPVpdlou2mJmuiQ1jFoS6HCMb9-d1jzB6YgI7P2Gl4FqaGMfwlMNTsV31hyA7Ft5sl9BuB2NOKdKcd_F5wYqZ-mlAUmI9A/s1600/Simple+Calculator.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHqJSTV7hEfZLwU0YusV-xwtPOGOH8CA3xAiFj2VZiRLJfrRPVpdlou2mJmuiQ1jFoS6HCMb9-d1jzB6YgI7P2Gl4FqaGMfwlMNTsV31hyA7Ft5sl9BuB2NOKdKcd_F5wYqZ-mlAUmI9A/s1600/Simple+Calculator.png&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;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Hey Guys!!! Welcome once again.It&#39;s &amp;nbsp;Parth here.In this tutorial we are going to make a simple calculator which can perform addition,subtraction,multiplication,and division operation.For that you need 4 buttons,2 text field to insert input to the calc and a label to print the calculated input.I have used grid layout of 4X4.Here i have used the pannel of 300px X 300px, you can use your own size.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Let&#39;s start to program the calculator.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;import
java.awt.*;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;import
java.awt.event.*;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;class MyFrame
extends Frame implements ActionListener&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Button b1,b2,b3,b4;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextField t,tx;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Label l;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int n;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;MyFrame()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t = new TextField(10);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tx = new TextField(10);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b1= new
Button(&quot;+&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b2= new
Button(&quot;-&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b3= new
Button(&quot;*&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b4= new
Button(&quot;/&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l = new
Label(&quot;Ans&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setLayout(new
GridLayout(4,4));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add(t);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add(tx);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add(b1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add(b2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add(b3);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add(b4);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;add(l);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;b1.addActionListener(this);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b2.addActionListener(this);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b3.addActionListener(this);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b4.addActionListener(this);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;public void
actionPerformed(ActionEvent e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String
a=t.getText();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int n1=Integer.parseInt(a);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String b=tx.getText();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int
n2=Integer.parseInt(a);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String
s=e.getActionCommand();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(s.equals(&quot;+&quot;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n=n1+n2; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
if(s.equals(&quot;-&quot;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n=n1-n2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
if(s.equals(&quot;*&quot;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n=n1*n2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(s.equals(&quot;/&quot;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n=n1/n2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;l.setText(n+&quot;
&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;class Demo&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String
args[])&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyFrame a=new MyFrame();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.setSize(300,300);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.setVisible(true);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;





































































































































&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-size: 12.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Output of this program is same as the above image.If you have any query comment below. &lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/5200821784303314442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-java-program-to-make-simple-calculator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5200821784303314442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5200821784303314442'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-java-program-to-make-simple-calculator.html' title='A Java Program to make a simple calculator.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQMCU-nU4ZPDH0yZxfd8uaP_DpvEDpZC8X3BfNz0C0lNy5dt4vY46wdZHEvHeUFMyRA8mGDHyaMWp7v6siblFWC3cUy1RNjxqJIozcSgoo4jfyzTSvH_QkZUHRdji7jKPIieSGan9Jg8M/s72-c/Java+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-5332497207326662670</id><published>2015-01-11T13:41:00.000+05:30</published><updated>2015-01-12T11:14:02.339+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Video Tutorials"/><title type='text'>A video tutorial to create database in wamp server.</title><content type='html'>&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/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s1600/Video+Banner.png&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;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/MvCqebTq8_Y/0.jpg&quot; height=&quot;266&quot; width=&quot;320&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;https://www.youtube.com/v/MvCqebTq8_Y?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;https://www.youtube.com/v/MvCqebTq8_Y?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&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;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
A video tutorial to create a database named abc in the wamp server and a table named abc in the wamp server.&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/5332497207326662670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-video-tutorial-to-create-database-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5332497207326662670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/5332497207326662670'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-video-tutorial-to-create-database-in.html' title='A video tutorial to create database in wamp server.'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQl4gl4uXb-NNX_KEvUJPlhJIqc7PNV17eKjd2ccqCkjMTbU94VR54GT_vr5QQzbB9ptitpbZxjb6j9rIgw1hgPZK1H0dym8sQIHCk7p3Qj6Em48ThgKrWbYW0hbIyOaY1ZsvMWFYPM5k/s72-c/Video+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3966777529669130115.post-7450306552634358928</id><published>2015-01-11T11:58:00.002+05:30</published><updated>2015-01-12T11:14:17.458+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Video Tutorials"/><title type='text'>A Video tutorial to learn how to install Wamp Server laptop or desktop</title><content type='html'>&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/AVvXsEg2dK91NZYwLiqhfZXaF8N4YkyH56dtDw-C_EJyVjWf2fO_EH-2EfoqORwvf5i68JgQGGJ5suETyhN0ax4Z2uHs11iJMei60qQndLlKth4v3vln7OvtbQdlQd3e_XfwpLTyGTTMVDINGCo/s1600/Video+Banner.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2dK91NZYwLiqhfZXaF8N4YkyH56dtDw-C_EJyVjWf2fO_EH-2EfoqORwvf5i68JgQGGJ5suETyhN0ax4Z2uHs11iJMei60qQndLlKth4v3vln7OvtbQdlQd3e_XfwpLTyGTTMVDINGCo/s1600/Video+Banner.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/4SW5wzPD7Q8?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A video tutorial to learn how to install wamp server on your laptop or desktop pc.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cfetch.blogspot.com/feeds/7450306552634358928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-video-tutorial-to-learn-how-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7450306552634358928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3966777529669130115/posts/default/7450306552634358928'/><link rel='alternate' type='text/html' href='http://cfetch.blogspot.com/2015/01/a-video-tutorial-to-learn-how-to.html' title='A Video tutorial to learn how to install Wamp Server laptop or desktop'/><author><name>Parth Patel</name><uri>http://www.blogger.com/profile/01813012418560131551</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2dK91NZYwLiqhfZXaF8N4YkyH56dtDw-C_EJyVjWf2fO_EH-2EfoqORwvf5i68JgQGGJ5suETyhN0ax4Z2uHs11iJMei60qQndLlKth4v3vln7OvtbQdlQd3e_XfwpLTyGTTMVDINGCo/s72-c/Video+Banner.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>