<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>electrofriends.com &#187; Number Programs</title>
	<atom:link href="http://electrofriends.com/category/source-codes/software-programs/c/number-programs/feed/" rel="self" type="application/rss+xml" />
	<link>http://electrofriends.com</link>
	<description>...bringing innovative minds together</description>
	<lastBuildDate>Fri, 11 May 2012 08:44:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Program to accept a list of numbers and display it in reverse order using function concept</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-list-numbers-display-reverse-order-function-concept/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-list-numbers-display-reverse-order-function-concept/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 12:34:58 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[Number Programs]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=2227</guid>
		<description><![CDATA[This program accepts a list of numbers and displays it in reverse order using function concept. 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 #include &#34;stdio.h&#34; #include &#34;conio.h&#34; &#160; int a&#91;5&#93;,b&#91;5&#93;; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>This program accepts a list of numbers and displays it in reverse order using function concept.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;stdio.h&quot;</span>
<span style="color: #339933;">#include &quot;conio.h&quot;</span>
&nbsp;
<span style="color: #993333;">int</span> a<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>b<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> accept<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   <span style="color: #993333;">int</span> j<span style="color: #339933;">;</span>
   <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the list <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>j<span style="color: #339933;">--,</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
     b<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>a<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> display<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   <span style="color: #993333;">int</span> j<span style="color: #339933;">;</span>
   <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;The list in reverse is <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>j<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">5</span><span style="color: #339933;">;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
   <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d &quot;</span><span style="color: #339933;">,</span>b<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   accept<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   reverse<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   display<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Output:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Enter the list
<span style="color: #0000dd;">5</span>
<span style="color: #0000dd;">4</span>
<span style="color: #0000dd;">3</span>
<span style="color: #0000dd;">2</span>
<span style="color: #0000dd;">1</span>
The list in reverse is
<span style="color: #0000dd;">1</span> <span style="color: #0000dd;">2</span> <span style="color: #0000dd;">3</span> <span style="color: #0000dd;">4</span> <span style="color: #0000dd;">5</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-list-numbers-display-reverse-order-function-concept/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>program to accept ten numbers from the user and display the lowest one</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-ten-numbers-user-display-lowest/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-ten-numbers-user-display-lowest/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 12:05:14 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[Number Programs]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=2225</guid>
		<description><![CDATA[This program accepts ten numbers from the user and display the lowest one, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include &#34;conio.h&#34; #include &#34;stdio.h&#34; &#160; void main&#40;&#41; &#123; int num&#91;10&#93;,low,i=0,j=1; printf&#40;&#34;\nPlease provide 10 numbers to find lowest one [...]]]></description>
			<content:encoded><![CDATA[<p>This program accepts ten numbers from the user and display the lowest one,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;conio.h&quot;</span>
<span style="color: #339933;">#include &quot;stdio.h&quot;</span>
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> num<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>low<span style="color: #339933;">,</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Please provide 10 numbers to find lowest one &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++,</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Enter number %d : &quot;</span><span style="color: #339933;">,</span>j<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>num<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  low<span style="color: #339933;">=</span>num<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//finding greatest number</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">;</span>inum<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    low<span style="color: #339933;">=</span>num<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//displaying lowest value</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>The lowest number is : %d&quot;</span><span style="color: #339933;">,</span>low<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Output:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Please provide <span style="color: #0000dd;">10</span> numbers to find lowest one
Enter number <span style="color: #0000dd;">1</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">45</span>
Enter number <span style="color: #0000dd;">2</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">63</span>
Enter number <span style="color: #0000dd;">3</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">85</span>
Enter number <span style="color: #0000dd;">4</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">77</span>
Enter number <span style="color: #0000dd;">5</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">21</span>
Enter number <span style="color: #0000dd;">6</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">68</span>
Enter number <span style="color: #0000dd;">7</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">79</span>
Enter number <span style="color: #0000dd;">8</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">82</span>
Enter number <span style="color: #0000dd;">9</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">101</span>
Enter number <span style="color: #0000dd;">10</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">22</span>
The lowest number is <span style="color: #339933;">:</span> <span style="color: #0000dd;">21</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-ten-numbers-user-display-lowest/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Program to accept ten numbers from the user and display the largest one</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-ten-numbers-user-display-largest/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-ten-numbers-user-display-largest/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 11:42:47 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[Number Programs]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=2223</guid>
		<description><![CDATA[This program accepts ten numbers from the user and displays the largest one,]]></description>
			<content:encoded><![CDATA[<p>This program accepts ten numbers from the user and displays the largest one,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;conio.h&quot;</span>
<span style="color: #339933;">#include &quot;stdio.h&quot;</span>
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> num<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>grt<span style="color: #339933;">,</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Please provide 10 numbers to find largest one &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++,</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Enter number %d : &quot;</span><span style="color: #339933;">,</span>j<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>num<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  grt<span style="color: #339933;">=</span>num<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//finding largest number</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">9</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>grt<span style="color: #339933;">&lt;</span>num<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    grt<span style="color: #339933;">=</span>num<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//displaying largest value</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>The largest number is : %d&quot;</span><span style="color: #339933;">,</span>grt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Output:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Please provide <span style="color: #0000dd;">10</span> numbers to find largest one
Enter number <span style="color: #0000dd;">1</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">41</span>
Enter number <span style="color: #0000dd;">2</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">75</span>
Enter number <span style="color: #0000dd;">3</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">76</span>
Enter number <span style="color: #0000dd;">4</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">40</span>
Enter number <span style="color: #0000dd;">5</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">55</span>
Enter number <span style="color: #0000dd;">6</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">59</span>
Enter number <span style="color: #0000dd;">7</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">48</span>
Enter number <span style="color: #0000dd;">8</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">54</span>
Enter number <span style="color: #0000dd;">9</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">71</span>
Enter number <span style="color: #0000dd;">10</span> <span style="color: #339933;">:</span> <span style="color: #0000dd;">48</span>
The largest number is <span style="color: #339933;">:</span> <span style="color: #0000dd;">76</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-accept-ten-numbers-user-display-largest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program to find the value of the polynomial f(x)=a4x4+a3x3+a2x2+a1x+a0 using Horner&#8217;s method</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-find-polynomial-fxa4x4a3x3a2x2a1xa0-horners-method-2/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-find-polynomial-fxa4x4a3x3a2x2a1xa0-horners-method-2/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 16:24:55 +0000</pubDate>
		<dc:creator>chitra</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[Horner's method]]></category>
		<category><![CDATA[polynomial]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=2119</guid>
		<description><![CDATA[Here is the program to find the value of the polynomial f(x)=a4x^4+a3x^3+a2x^2+a1^x+a0 using Horner&#8217;s method 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include &#34;stdio.h&#34; #include &#34;conio.h&#34; void main&#40;&#41; &#123; float a&#91;100&#93;,sum=0,x; int n,i; clrscr&#40;&#41;; printf&#40;&#34;Enter the degree of [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to find the value of the polynomial f(x)=a4x^4+a3x^3+a2x^2+a1^x+a0 using Horner&#8217;s method</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;stdio.h&quot;</span>
<span style="color: #339933;">#include &quot;conio.h&quot;</span>
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #993333;">float</span> a<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>sum<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>x<span style="color: #339933;">;</span>
 <span style="color: #993333;">int</span> n<span style="color: #339933;">,</span>i<span style="color: #339933;">;</span>
 clrscr<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the degree of the polynomial:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the coefficients into the array:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span>n<span style="color: #339933;">;</span>i<span style="color: #339933;">&gt;=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
  scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%f&quot;</span><span style="color: #339933;">,&amp;</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter the value of x:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%f&quot;</span><span style="color: #339933;">,&amp;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span>n<span style="color: #339933;">;</span>i<span style="color: #339933;">&gt;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
  sum<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>sum<span style="color: #339933;">+</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>x<span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 sum<span style="color: #339933;">=</span>sum<span style="color: #339933;">+</span>a<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Value of the polynomial is =%f&quot;</span><span style="color: #339933;">,</span>sum<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Consider the polynomial 3x^4+2x^3+x^2+x+2 where x=2, then the output will be as follows,<br />
Output:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Enter the degree of the polynomial<span style="color: #339933;">:</span>
<span style="color: #0000dd;">4</span>
Enter the coefficients into the array<span style="color: #339933;">:</span>
<span style="color: #0000dd;">3</span>
<span style="color: #0000dd;">2</span>
<span style="color: #0000dd;">1</span>
<span style="color: #0000dd;">1</span>
<span style="color: #0000dd;">2</span>
Enter the value of x<span style="color: #339933;">:</span>
<span style="color: #0000dd;">2</span>
Value of the polynomial is<span style="color: #339933;">:</span><span style="color:#800080;">72.000000</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-find-polynomial-fxa4x4a3x3a2x2a1xa0-horners-method-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C program to calculate the GCD of a number</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/c-program-to-calculate-the-gcd-of-a-number/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/c-program-to-calculate-the-gcd-of-a-number/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 13:04:32 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[calculate]]></category>
		<category><![CDATA[GCD of a number]]></category>
		<category><![CDATA[Greatest Common Divisor]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=1136</guid>
		<description><![CDATA[Write a program to calculate the Greatest Common Divisor(GCD) of a number #include&#60;stdio.h&#62; #include&#60;conio.h&#62; #include&#60;process.h&#62; int gcd&#40;int m,int n&#41; &#123; int rem; while&#40;n!=0&#41; &#123; rem=m%n; m=n; n=rem; &#125; return&#40;m&#41;; &#125; main&#40;&#41; &#123; int num1,num2,num3,gcd1,gcd2; clrscr&#40;&#41;; printf&#40;&#34;Enter three positive integers&#34;&#41;; scanf&#40;&#34;%d%d%d&#34;,&#38;num1,&#38;num2,&#38;num3&#41;; if&#40;num1==0 &#38;&#38; num2==0 &#38;&#38; num3==0&#41; &#123; printf&#40;&#34;\n Invalid number&#34;&#41;; exit&#40;0&#41;; &#125; gcd1=gcd&#40;num1,num2&#41;; gcd2=gcd&#40;num3,gcd1&#41;; printf&#40;&#34;\n GCD [...]]]></description>
			<content:encoded><![CDATA[<p>Write a program to calculate the Greatest Common Divisor(GCD) of a number</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include&lt;stdio.h&gt;</span>
<span style="color: #339933;">#include&lt;conio.h&gt;</span>
<span style="color: #339933;">#include&lt;process.h&gt;</span>
<span style="color: #993333;">int</span> gcd<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> m<span style="color: #339933;">,</span><span style="color: #993333;">int</span> n<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">int</span> rem<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>n<span style="color: #339933;">!=</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		rem<span style="color: #339933;">=</span>m<span style="color: #339933;">%</span>n<span style="color: #339933;">;</span>
		m<span style="color: #339933;">=</span>n<span style="color: #339933;">;</span>
		n<span style="color: #339933;">=</span>rem<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>m<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">int</span> num1<span style="color: #339933;">,</span>num2<span style="color: #339933;">,</span>num3<span style="color: #339933;">,</span>gcd1<span style="color: #339933;">,</span>gcd2<span style="color: #339933;">;</span>
	clrscr<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter three positive integers&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d%d%d&quot;</span><span style="color: #339933;">,&amp;</span>num1<span style="color: #339933;">,&amp;</span>num2<span style="color: #339933;">,&amp;</span>num3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>num1<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> num2<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> num3<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> Invalid number&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	gcd1<span style="color: #339933;">=</span>gcd<span style="color: #009900;">&#40;</span>num1<span style="color: #339933;">,</span>num2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	gcd2<span style="color: #339933;">=</span>gcd<span style="color: #009900;">&#40;</span>num3<span style="color: #339933;">,</span>gcd1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> GCD of %d %d %d is : %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>num1<span style="color: #339933;">,</span>num2<span style="color: #339933;">,</span>num3<span style="color: #339933;">,</span>gcd2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/c-program-to-calculate-the-gcd-of-a-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C program for finding remainder</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/c-program-for-finding-remainder/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/c-program-for-finding-remainder/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 04:35:20 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[binary remainder]]></category>
		<category><![CDATA[c programs]]></category>
		<category><![CDATA[finding remainder]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=783</guid>
		<description><![CDATA[OUTPUT:
enter frame:
1 0 1 1 0 1 0 0
enter generator:
1 0 1 0
remainder is:
0 0 1 0]]></description>
			<content:encoded><![CDATA[<p>OUTPUT:<br />
enter frame:<br />
1 0 1 1 0 1 0 0<br />
enter generator:<br />
1 0 1 0<br />
remainder is:<br />
0 0 1 0</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include&lt;stdio.h&gt;</span>
<span style="color: #339933;">#include&lt;conio.h&gt;</span>
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #993333;">int</span>  i<span style="color: #339933;">,</span>j<span style="color: #339933;">,</span>gen<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>rem<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>frl<span style="color: #339933;">=</span><span style="color: #0000dd;">8</span><span style="color: #339933;">,</span>genl<span style="color: #339933;">=</span><span style="color: #0000dd;">4</span><span style="color: #339933;">,</span>k<span style="color: #339933;">,</span>k1<span style="color: #339933;">,</span>fr<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">11</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 clrscr<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;enter frame:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>frl<span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span> 
scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>fr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span>frl<span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">11</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span> 
fr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;enter generator:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">4</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
 scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,&amp;</span>gen<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>k<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>k<span style="color: #339933;">&lt;</span>frl<span style="color: #339933;">;</span>k<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>fr<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
   k1<span style="color: #339933;">=</span>k<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span>k<span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>genl<span style="color: #339933;">;</span>i<span style="color: #339933;">++,</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
     rem<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>fr<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">^</span>gen<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>genl<span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
	  fr<span style="color: #009900;">&#91;</span>k1<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>rem<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
     k1<span style="color: #339933;">++;</span>
    <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>remainder is: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">4</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
     <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #339933;">,</span>rem<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     getch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>OUTPUT:<br />
enter frame:<br />
1 0 1 1 0 1 0 0<br />
enter generator:<br />
1 0 1 0<br />
remainder is:<br />
0 0 1 0</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/c-program-for-finding-remainder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To find the sum of the cos series</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-find-the-sum-of-the-cos-series/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-find-the-sum-of-the-cos-series/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 06:04:45 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=345</guid>
		<description><![CDATA[Here is the program to find the Cosine of the given angle for the user defined accuracy. This is a fast, reliable and robust program, which uses no sophisticated functions but a simple while loop and other math functions. Logic: The program follows the mathematical cosine series, where cosine of the entered radian angle ? [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to find the Cosine of the given angle for the user defined accuracy. This is a fast, reliable and robust program, which uses no sophisticated functions but a simple while loop and other math functions.</p>
<p>Logic: The program follows the mathematical cosine series, where cosine of the entered radian angle ? is,</p>
<p>The program asks the user to enter the Angle x° . Also it asks for the number of iterations &#8216;n&#8217; that the cosine loop should iterate. As the iteration increases, the accuracy boosts up. After the desired loop, the resultant gets printed out. Similar algorithm can be set to find the Sine value of the given number.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;math.h&gt;<br />
void main()<br />
{<br />
float pow = 2.0, nr, dr = 1.0, x1, sum;<br />
int i = 1,n,s = -1,x;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER THE ANGLE&#8230;: &#8220;);<br />
scanf(&#8220;%d&#8221;, &amp;x);<br />
x1 = 3.142 * (x / 180.0);<br />
sum = 1.0;<br />
nr = x1*x1;<br />
printf(&#8220;\n\t ENTER THE NUMBER OF TERMS&#8230;: &#8220;);<br />
scanf(&#8220;%d&#8221;,&amp;n);<br />
while(i&lt;=n)<br />
{<br />
dr = dr * pow * (pow &#8211; 1.0);<br />
sum = sum + (nr / (dr * s));<br />
s = s * (-1);<br />
pow = pow + 2.0;<br />
nr = nr * x1 * x1;<br />
i++;<br />
}<br />
printf(&#8220;\n\t THE SUM OF THE COS SERIES IS..: %0.3f&#8221;, sum);<br />
getch();<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/cos.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-find-the-sum-of-the-cos-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program to find the sum of the sine series</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-to-find-the-sum-of-the-sine-series/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-to-find-the-sum-of-the-sine-series/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 06:01:44 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=342</guid>
		<description><![CDATA[Here is the program to find the Sinusoidal value of the given angle for the user defined accuracy. This is a fast, reliable and robust program, which uses no built in functions but a simple while loop and other math functions. Logic: The program follows the mathematical sine series, where cosine of the entered radian [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to find the Sinusoidal value of the given angle for the user defined accuracy. This is a fast, reliable and robust program, which uses no built in functions but a simple while loop and other math functions.</p>
<p>Logic: The program follows the mathematical sine series, where cosine of the entered radian angle x  is,</p>
<p>The program asks the user to enter the Angle x° . Also it asks for the number of iterations &#8216;n&#8217; that the sine loop should iterate. As the iteration increases, the accuracy boosts up. After the desired loop, the resultant gets printed out. Similar algorithm can be set to find the Cosine value of the given number.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;math.h&gt;<br />
void main()<br />
{<br />
int i = 2, n, s = 1, x, pwr = 1, dr;<br />
float nr = 1, x1, sum;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER THE ANGLE&#8230;: &#8220;);<br />
scanf(&#8220;%d&#8221;, &amp;x);<br />
x1 = 3.142 * (x / 180.0);<br />
sum = x1;<br />
printf(&#8220;\n\t ENTER THE NUMBER OF TERMS&#8230;: &#8220;);<br />
scanf(&#8220;%d&#8221;, &amp;n);<br />
while(i &lt;= n)<br />
{<br />
pwr = pwr + 2;<br />
dr = dr * pwr * (pwr &#8211; 1);<br />
sum = sum + (nr / dr) * s;<br />
s = s * (-1);<br />
nr = nr * x1 * x1;<br />
i+= 2;<br />
}<br />
printf(&#8220;\n\t THE SUM OF THE SINE SERIES IS..: %0.3f&#8221;,sum);<br />
getch();<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/sine.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/program-to-find-the-sum-of-the-sine-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To find the sum of digits</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-find-the-sum-of-digits/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-find-the-sum-of-digits/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 05:58:40 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=338</guid>
		<description><![CDATA[Here is the program to find the sum of the digits of the entered number. Main idea in this program is to slice down the given number into digits and to operate on them. Logic : The program asks the user to enter the number, to find out the sum of its digits. Sets the [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the program to find the sum of the digits of the entered number. Main idea in this program is to slice down the given number into digits and to operate on them.</p>
<p><strong>Logic :</strong> The program asks the user to enter the number, to find out the sum of its digits. Sets the flag &#8216;sum&#8217; to zero, implies that sum till now is Nil. Stores the entered number as Num. The while loop slices the number into digits. In each iteration, the current digit gets added up to the flag &#8216;Sum&#8217; . Finally it prints out the number.</p>
<p>The same logic can be implemented for other programs too, where the situation comes to slice up the given number, as in the case of  Reversing the number.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;math.h&gt;<br />
void main()<br />
{<br />
long int num,sum = 0,dig;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A NUMBER&#8230;: &#8220;);<br />
scanf(&#8220;%ld&#8221;,&amp;num);<br />
while(num&gt;0)<br />
{<br />
dig = num % 10;<br />
sum = sum + dig;<br />
num = num / 10;<br />
}<br />
printf(&#8220;\n\t SUM OF DIGITS IS&#8230;: %ld&#8221;, sum);<br />
getch();<br />
}</p>
<p><a href="http://electrofriends.com/wp-content/uploads/2008/12/sum_dig.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-find-the-sum-of-digits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To check whether a given number is palindrome or not</title>
		<link>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-check-whether-a-given-number-is-palindrome-or-not/</link>
		<comments>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-check-whether-a-given-number-is-palindrome-or-not/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 05:55:31 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Number Programs]]></category>
		<category><![CDATA[C/C++ Programms]]></category>
		<category><![CDATA[Source Codes]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=335</guid>
		<description><![CDATA[This is the program to check for the &#8216;Palindrome&#8217; property of the given number. Palindrome is the instinct property of any literal segment, where the segment reads the same either from left to right or vice versa. For example : 12321 and  LEVEL  are the palindromes as they reads same if we go from right [...]]]></description>
			<content:encoded><![CDATA[<p>This is the program to check for the &#8216;Palindrome&#8217; property of the given number. Palindrome is the instinct property of any literal segment, where the segment reads the same either from left to right or vice versa.<br />
For example : 12321 and  LEVEL  are the palindromes as they reads same if we go from right to left also.</p>
<p>Logic :  The program expects the user to enter the number to check if palindrome. The entered number is reversed and stored in another variable. Finally the reversed number is checked for equality with the entered number. If they are the same, then it is a palindrome.</p>
<p>A slight change in the code can check if the entered string is a palindrome.</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;math.h&gt;<br />
void main()<br />
{<br />
long int n, num, rev = 0, dig;<br />
clrscr();<br />
printf(&#8220;\n\n\t ENTER A NUMBER&#8230;: &#8220;);<br />
scanf(&#8220;%ld&#8221;, &amp;num);<br />
n = num;<br />
while(num&gt;0)<br />
{<br />
dig = num % 10;<br />
rev = rev * 10 + dig;<br />
num = num / 10;<br />
}<br />
if (n == rev)<br />
printf(&#8220;\n\t GIVEN NUMBER IS A PALINDROME&#8221;);<br />
else<br />
printf(&#8220;\n\t GIVEN NUMBER NOT A PALINDROME&#8221;);<br />
getch();<br />
}<br />
<a href="http://electrofriends.com/wp-content/uploads/2008/12/num_pali.zip">Download exe and source code here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/source-codes/software-programs/c/number-programs/to-check-whether-a-given-number-is-palindrome-or-not/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

