<?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-6465526636981825723</id><updated>2024-08-28T12:46:39.659-07:00</updated><title type='text'>C Language</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><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><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6465526636981825723.post-2916919252153758121</id><published>2011-05-20T04:07:00.000-07:00</published><updated>2011-05-20T04:07:59.583-07:00</updated><title type='text'>Write a C program to convert a Roman numeral to its decimal equivalent.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #453320; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;#include&amp;lt;string.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;int *a,len,i,j,k;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;char *rom;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;clrscr();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(“Enter the Roman Numeral:”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;scanf(“%s”,rom);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;len=strlen(rom);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;for(i=0;i&amp;lt;len;i++)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if(rom[i]==’I&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=1;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(rom[i]==’V&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=5;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(rom[i]==’X&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=10;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(rom[i]==’L&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=50;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(rom[i]==’C&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=100;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(rom[i]==’D&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=500;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(rom[i]==’M&#39;)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;a[i]=1000;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“\nInvalid Value”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;getch();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;exit(0);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;k=a[len-1];&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;for(i=len-1;i&amp;gt;0;i–)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if(a[i]&amp;gt;a[i-1])&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;k=k-a[i-1];&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else if(a[i]==a[i-1] || a[i]&amp;lt;a[i-1])&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;k=k+a[i-1];&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“\nIts Decimal Equivalent is:”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“%d”,k);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;getch();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/2916919252153758121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-convert-roman.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/2916919252153758121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/2916919252153758121'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-convert-roman.html' title='Write a C program to convert a Roman numeral to its decimal equivalent.'/><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-6465526636981825723.post-7227794861278583068</id><published>2011-05-20T04:04:00.000-07:00</published><updated>2011-05-20T04:04:46.141-07:00</updated><title type='text'>Write a C program to find the 2’s complement of a binary number.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1506px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;2’s complement of a number is obtained by scanning it from right to left and complementing all the bits after the first appearance of a 1. Thus 2’s complement of 11100 is 00100. Write a C program to find the 2’s complement of a binary number.&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;strong&gt;Program:&lt;/strong&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;clrscr();&lt;br /&gt;
printf(&quot;Enter the binary number&quot;);&lt;br /&gt;
gets(a);&lt;br /&gt;
for(i=0;a[i]!=&#39;\0&#39;; i++)&lt;br /&gt;
{&lt;br /&gt;
if (a[i]!=&#39;0&#39; &amp;amp;&amp;amp; a[i]!=&#39;1&#39;)&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;The number entered is not a binary number. Enter the correct number&quot;);&lt;br /&gt;
exit(0);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
complement(a);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
void complement (char *a)&lt;br /&gt;
{&lt;br /&gt;
int l, i, c=0;&lt;br /&gt;
char b[16];&lt;br /&gt;
l=strlen(a);&lt;br /&gt;
for (i=l-1; i&amp;gt;=0; i--)&lt;br /&gt;
{&lt;br /&gt;
if (a[i]==&#39;0&#39;)&lt;br /&gt;
b[i]=&#39;1&#39;;&lt;br /&gt;
else&lt;br /&gt;
b[i]=&#39;0&#39;;&lt;br /&gt;
}&lt;br /&gt;
for(i=l-1; i&amp;gt;=0; i--)&lt;br /&gt;
{&lt;br /&gt;
if(i==l-1)&lt;br /&gt;
{&lt;br /&gt;
if (b[i]==&#39;0&#39;)&lt;br /&gt;
b[i]=&#39;1&#39;;&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
b[i]=&#39;0&#39;;&lt;br /&gt;
c=1;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
if(c==1 &amp;amp;&amp;amp; b[i]==&#39;0&#39;)&lt;br /&gt;
{&lt;br /&gt;
b[i]=&#39;1&#39;;&lt;br /&gt;
c=0;&lt;br /&gt;
}&lt;br /&gt;
else if (c==1 &amp;amp;&amp;amp; b[i]==&#39;1&#39;)&lt;br /&gt;
{&lt;br /&gt;
b[i]=&#39;0&#39;;&lt;br /&gt;
c=1;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
b[l]=&#39;\0&#39;;&lt;br /&gt;
printf(&quot;The 2&#39;s complement is %s&quot;, b);&lt;br /&gt;
}&lt;br /&gt;
&lt;strong&gt;/*&lt;br /&gt;
Output:&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;Enter the binary number101&lt;br /&gt;
The 2&#39;s complement is 011&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;*/&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/7227794861278583068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-find-2s-complement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/7227794861278583068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/7227794861278583068'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-find-2s-complement.html' title='Write a C program to find the 2’s complement of a binary number.'/><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-6465526636981825723.post-5461206239377695278</id><published>2011-05-20T04:02:00.000-07:00</published><updated>2011-05-20T04:02:50.915-07:00</updated><title type='text'>Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression: 1+x+x2+x3+………….+xn</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1060px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression:&lt;br /&gt;
1+x+x2+x3+………….+xn&lt;br /&gt;
For example: if n is 3 and x is 5, then the program computes 1+5+25+125.&lt;br /&gt;
Print x, n, the sum&lt;br /&gt;
Perform error checking. For example, the formula does not make sense for negative exponents – if n is less than 0. Have your program print an error message if n&amp;lt;0, then go back and read in the next pair of numbers of without computing the sum. Are any values of x also illegal ? If so, test for them too.&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;strong&gt;Program:&lt;/strong&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;math.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int s_sum,i,x,n;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;clrscr();&lt;br /&gt;
printf(&quot;Enter the values for x and n:&quot;);&lt;br /&gt;
scanf(&quot;%d %d&quot;,&amp;amp;x,&amp;amp;n);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;if(n&amp;lt;=0 || x&amp;lt;=0)&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;Value is not valid\n&quot;);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
s_sum=1;&lt;br /&gt;
for(i=1;i&amp;lt;=n;i++)&lt;br /&gt;
{&lt;br /&gt;
s_sum=s_sum+pow(x,i);&lt;br /&gt;
}&lt;br /&gt;
printf(&quot;Sum of series=%d\n&quot;,s_sum);&lt;br /&gt;
}&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
&lt;strong&gt;/*&lt;br /&gt;
Output:&lt;br /&gt;
Enter the values for x and n:2 4&lt;br /&gt;
Sum of series=31&lt;br /&gt;
*/&lt;/strong&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/5461206239377695278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-read-in-two-numbers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/5461206239377695278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/5461206239377695278'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-read-in-two-numbers.html' title='Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression: 1+x+x2+x3+………….+xn'/><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-6465526636981825723.post-4638984526633074278</id><published>2011-05-20T04:01:00.000-07:00</published><updated>2011-05-20T04:01:23.355-07:00</updated><title type='text'>Write a C program to construct a pyramid of numbers.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1038px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int num,i,y,x=35;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;\nEnter the number to generate the pyramid:\n&quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;num);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;for(y=0;y&amp;lt;=num;y++)&lt;br /&gt;
{&lt;br /&gt;
/*(x-coordinate,y-coordinate)*/&lt;br /&gt;
gotoxy(x,y+1);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/*for displaying digits towards the left and right of zero*/&lt;br /&gt;
for(i=0-y;i&amp;lt;=y;i++)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;%3d&quot;,abs(i));&lt;br /&gt;
x=x-3;&lt;br /&gt;
}&lt;br /&gt;
getch();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/&lt;strong&gt;*&lt;br /&gt;
Output:&lt;br /&gt;
Enter the number to generate the pyramid:&lt;br /&gt;
5&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;0&lt;br /&gt;
1 0 1&lt;br /&gt;
2 1 0 1 2&lt;br /&gt;
3 2 1 0 1 2 3&lt;br /&gt;
4 3 2 1 0 1 2 3 4&lt;br /&gt;
5 4 3 2 1 0 1 2 3 4 5&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/4638984526633074278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-construct-pyramid-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4638984526633074278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4638984526633074278'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-construct-pyramid-of.html' title='Write a C program to construct a pyramid of numbers.'/><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-6465526636981825723.post-6243936496308119604</id><published>2011-05-20T04:00:00.000-07:00</published><updated>2011-05-20T04:00:12.544-07:00</updated><title type='text'>Write a C program to generate Pascal’s triangle.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1161px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int bin,p,q,r,x;&lt;br /&gt;
clrscr();&lt;br /&gt;
bin=1;&lt;br /&gt;
q=0;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;Rows you want to input:&quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;r);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;\nPascal&#39;s Triangle:\n&quot;);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;while(q&amp;lt;r)&lt;br /&gt;
{&lt;br /&gt;
for(p=40-3*q;p&amp;gt;0;--p)&lt;br /&gt;
printf(&quot; &quot;);&lt;br /&gt;
for(x=0;x&amp;lt;=q;++x)&lt;br /&gt;
{&lt;br /&gt;
if((x==0)||(q==0))&lt;br /&gt;
bin=1;&lt;br /&gt;
else&lt;br /&gt;
bin=(bin*(q-x+1))/x;&lt;br /&gt;
printf(&quot;%6d&quot;,bin);&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;\n&quot;);&lt;br /&gt;
++q;&lt;br /&gt;
}&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;br /&gt;
/*&lt;br /&gt;
Rows you want to input:6&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Pascal&#39;s Triangle:&lt;br /&gt;
1&lt;br /&gt;
1 1&lt;br /&gt;
1 2 1&lt;br /&gt;
1 3 3 1&lt;br /&gt;
1 4 6 4 1&lt;br /&gt;
1 5 10 10 5 1&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/6243936496308119604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-generate-pascals.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/6243936496308119604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/6243936496308119604'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-generate-pascals.html' title='Write a C program to generate Pascal’s triangle.'/><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-6465526636981825723.post-7283536907446999936</id><published>2011-05-20T03:58:00.000-07:00</published><updated>2011-05-20T03:58:18.387-07:00</updated><title type='text'>Write a C program to count the lines, words and characters in a given text.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #453320; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;main()&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;char line[81], ctr;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;int i,c,&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;end = 0,&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;characters = 0,&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;words = 0,&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;lines = 0;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“KEY IN THE TEXT.\n”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“GIVE ONE SPACE AFTER EACH WORD.\n”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“WHEN COMPLETED, PRESS ‘RETURN’.\n\n”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;while( end == 0)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;/* Reading a line of text */&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;c = 0;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;while((ctr=getchar()) != ‘\n’)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;line[c++] = ctr;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;line[c] = ”;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;/* counting the words in a line */&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if(line[0] == ”)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;break ;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;words++;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;for(i=0; line[i] != ”;i++)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if(line[i] == ‘ ‘ || line[i] == ‘\t’)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;words++;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;/* counting lines and characters */&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;lines = lines +1;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;characters = characters + strlen(line);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf (“\n”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“Number of lines = %d\n”, lines);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“Number of words = %d\n”, words);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“Number of characters = %d\n”, characters);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Output&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;KEY IN THE TEXT.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;GIVE ONE SPACE AFTER EACH WORD.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;WHEN COMPLETED, PRESS ‘RETURN’.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Admiration is a very short-lived passion.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Admiration involves a glorious obliquity of vision.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Always we like those who admire us but we do not&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;like those whom we admire.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Fools admire, but men of sense approve.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Number of lines = 5&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Number of words = 36&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Number of characters = 205&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/7283536907446999936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-count-lines-words.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/7283536907446999936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/7283536907446999936'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-to-count-lines-words.html' title='Write a C program to count the lines, words and characters in a given text.'/><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-6465526636981825723.post-3678076311281339532</id><published>2011-05-20T03:51:00.000-07:00</published><updated>2011-05-20T03:51:04.669-07:00</updated><title type='text'>a) Write a C program that displays the position or index in the string S where the string T begins, or – 1 if S doesn’t contain T.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;iframe frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm.amazon.com/e/cm?lt1=_blank&amp;amp;bc1=000000&amp;amp;IS2=1&amp;amp;bg1=FFFFFF&amp;amp;fc1=000000&amp;amp;lc1=0000FF&amp;amp;t=j0df5-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=as1&amp;amp;m=endless&amp;amp;f=ifr&amp;amp;ref=tf_til&amp;amp;asins=B000RBUEXU&quot; style=&quot;height: 240px; width: 120px;&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1062px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;string.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
char s[30], t[20];&lt;br /&gt;
char *found;&lt;br /&gt;
clrscr();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Entering the main string */&lt;br /&gt;
puts(&quot;Enter the first string: &quot;);&lt;br /&gt;
gets(s);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Entering the string whose position or index to be displayed */&lt;br /&gt;
puts(&quot;Enter the string to be searched: &quot;);&lt;br /&gt;
gets(t);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/*Searching string t in string s */&lt;br /&gt;
found=strstr(s,t);&lt;br /&gt;
if(found)&lt;br /&gt;
printf(&quot;Second String is found in the First String at %d position.\n&quot;,found-s);&lt;br /&gt;
else&lt;br /&gt;
printf(&quot;-1&quot;);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
/*&lt;br /&gt;
&lt;strong&gt;Output:&lt;/strong&gt;&lt;br /&gt;
Enter the first string:&lt;br /&gt;
sridhar siricilla&lt;br /&gt;
Enter the string to be searched:&lt;br /&gt;
siri&lt;br /&gt;
Second String is found in the First String at 8 position.&lt;br /&gt;
*/&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/3678076311281339532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-that-displays-position.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/3678076311281339532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/3678076311281339532'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/05/write-c-program-that-displays-position.html' title='a) Write a C program that displays the position or index in the string S where the string T begins, or – 1 if S doesn’t contain T.'/><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-6465526636981825723.post-7412259878449425169</id><published>2011-04-23T07:21:00.001-07:00</published><updated>2011-04-23T07:21:42.039-07:00</updated><title type='text'>Write a C program to determine if the given string is a palindrome or not</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;2nd method.......&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;#include&amp;lt;string.h&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;enum Boolean{false,true};&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;enum Boolean IsPalindrome(char string[])&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;int left,right,len=strlen(string);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;enum Boolean matched=true;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;if(len==0)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;return 0;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;left=0;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;right=len-1;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;/* Compare the first and last letter,second &amp;amp; second last &amp;amp; so on */&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;while(left&amp;lt;right&amp;amp;&amp;amp;matched)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;if(string[left]!=string[right])&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;matched=false;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;else&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;left++;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;right--;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;return matched;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;int main()&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;char string[40];&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;clrscr();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;printf(&quot;****Program to test if the given string is a palindrome****\n&quot;);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;printf(&quot;Enter a string:&quot;);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;scanf(&quot;%s&quot;,string);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;if(IsPalindrome(string))&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;printf(&quot;The given string %s is a palindrome\n&quot;,string);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;else&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;printf(&quot;The given string %s is not a palindrome\n&quot;,string);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;getch();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;return 0;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;/*&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Output:&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;****Program to test if the given string is a palindrome****&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Enter a string:liril&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;The given string liril is a palindrome&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;*/&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/7412259878449425169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-determine-if-given_23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/7412259878449425169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/7412259878449425169'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-determine-if-given_23.html' title='Write a C program to determine if the given string is a palindrome or not'/><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-6465526636981825723.post-5536964639640713636</id><published>2011-04-23T07:19:00.000-07:00</published><updated>2011-04-23T07:21:18.070-07:00</updated><title type='text'>Write a C program to determine if the given string is a palindrome or not</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1193px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;int stpal(char str[50]);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;void main()&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;char str[50];&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;int pal;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;clrscr();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“nnt ENTER A STRING…: “);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;gets(str);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;pal = stpal(str);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if(pal)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“nt THE ENTERED STRING IS A PALINDROME”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“nt THE ENTERED STRING IS NOT A PALINDROME”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;getch();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;int stpal(char str[50])&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;int i = 0, len = 0, pal = 1;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;while(str[len]!=’′)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;len++;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;len–;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;for(i=0; i&amp;lt;len/2; i++)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if(str[i] == str[len-i])&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;pal = 1;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;else&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;pal = 0;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;break;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;return pal;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/5536964639640713636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-determine-if-given.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/5536964639640713636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/5536964639640713636'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-determine-if-given.html' title='Write a C program to determine if the given string is a palindrome or not'/><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-6465526636981825723.post-1629217545919105302</id><published>2011-04-23T07:13:00.000-07:00</published><updated>2011-04-23T07:13:21.473-07:00</updated><title type='text'>write a c program to delete n Characters from a given position in a given string.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #453320; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 15px; line-height: 22px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;#include &amp;lt;conio.h&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;#include &amp;lt;string.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void delchar(char *x,int a, int b);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;char string[10];&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;int n,pos,p;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;clrscr();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;puts(“Enter the string”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;gets(string);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“Enter the position from where to delete”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;scanf(“%d”,&amp;amp;pos);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;printf(“Enter the number of characters to be deleted”);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;scanf(“%d”,&amp;amp;n);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;delchar(string, n,pos);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;getch();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.2em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;// Function to delete n characters&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;void delchar(char *x,int a, int b)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if ((a+b-1) &amp;lt;= strlen(x))&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;strcpy(&amp;amp;x[b-1],&amp;amp;x[a+b-1]);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;puts(x);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/1629217545919105302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-delete-n-characters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/1629217545919105302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/1629217545919105302'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-delete-n-characters.html' title='write a c program to delete n Characters from a given position in a given string.'/><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-6465526636981825723.post-4946356102987248795</id><published>2011-04-23T07:09:00.000-07:00</published><updated>2011-04-23T07:09:50.156-07:00</updated><title type='text'>write a c program to insert a sub-string in to given main string from a given position.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;string.h&amp;gt;&lt;br /&gt;
void main( )&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
char st[20],sub[10],temp[10];&lt;br /&gt;
int pos, i, j;&lt;br /&gt;
clrscr( );&lt;br /&gt;
printf(&quot;Enter the main string:&quot;);&lt;br /&gt;
gets(st);&lt;br /&gt;
printf(&quot;\nEnter the substring to insert:&quot;);&lt;br /&gt;
gets(sub);&lt;br /&gt;
printf(&quot;Enter the index position:&quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;pos);&lt;br /&gt;
if(pos&amp;lt;=strlen(st))&amp;nbsp;&lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
for(i=0;i&amp;lt;=strlen(st);i++)&amp;nbsp;&lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
if(i==pos)&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
for(j=0;st[i]!=&#39;\0&#39;;j++) // to store the &#39;st&#39; to &#39;temp&#39; from given position.&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
temp[j]=st[i];&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;i++;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
temp[j]=&#39;\0&#39;;&lt;br /&gt;
i=pos;&lt;br /&gt;
for(j=0;sub[j]!=&#39;\0&#39;;j++) // to insert a sub-str to main string.&lt;br /&gt;
{&lt;br /&gt;
st[i]=sub[j];&lt;br /&gt;
i++;&lt;br /&gt;
}&lt;br /&gt;
for(j=0;temp[j]!=&#39;\0&#39;;j++) // Lastly to insert the &#39;temp&#39; to &#39;st&#39; after sub-str.&lt;br /&gt;
{&lt;br /&gt;
st[i]=temp[j];&lt;br /&gt;
i++;&lt;br /&gt;
}&lt;br /&gt;
st[i]=&#39;\0&#39;;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
printf(&quot;\nAfter adding the sub-string: %s&quot;,st);&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
else&lt;br /&gt;
printf(&quot;\nSorry, it is not possible to insert a substring in that position.&quot;);&lt;br /&gt;
getch();&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/4946356102987248795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-insert-sub-string-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4946356102987248795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4946356102987248795'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-insert-sub-string-in.html' title='write a c program to insert a sub-string in to given main string from a given position.'/><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-6465526636981825723.post-8235805370449389598</id><published>2011-04-23T07:06:00.000-07:00</published><updated>2011-04-23T07:06:47.679-07:00</updated><title type='text'>Write a C program that uses functions to perform the following...</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 2832px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;b&gt;i) Addition of Two Matrices&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;b&gt;ii) Multiplication of Two Matrices&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int ch,i,j,m,n,p,q,k,r1,c1,a[10][10],b[10][10],c[10][10];&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;************************************&quot;);&lt;br /&gt;
printf(&quot;\n\t\tMENU&quot;);&lt;br /&gt;
printf(&quot;\n**********************************&quot;);&lt;br /&gt;
printf(&quot;\n[1]ADDITION OF TWO MATRICES&quot;);&lt;br /&gt;
printf(&quot;\n[2]MULTIPLICATION OF TWO MATRICES&quot;);&lt;br /&gt;
printf(&quot;\n[0]EXIT&quot;);&lt;br /&gt;
printf(&quot;\n**********************************&quot;);&lt;br /&gt;
printf(&quot;\n\tEnter your choice:\n&quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;ch);&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;switch(ch)&lt;br /&gt;
{&lt;br /&gt;
default:&lt;br /&gt;
printf(&quot;Invalide choice\n&quot;);&lt;br /&gt;
exit(1);&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 1:&lt;br /&gt;
printf(&quot;Input rows and columns of A &amp;amp; B Matrix:&quot;);&lt;br /&gt;
scanf(&quot;%d%d&quot;,&amp;amp;r1,&amp;amp;c1);&lt;br /&gt;
printf(&quot;Enter elements of matrix A:\n&quot;);&lt;br /&gt;
read_matrix(a,r1,c1);&lt;br /&gt;
printf(&quot;Enter elements of matrix B:\n&quot;);&lt;br /&gt;
read_matrix(b,r1,c1);&lt;br /&gt;
printf(&quot;\n =====Matrix Addition=====\n&quot;);&lt;br /&gt;
for(i=0;i&amp;lt;r1;i++)&lt;br /&gt;
{&lt;br /&gt;
for(j=0;j&amp;lt;c1;j++)&lt;br /&gt;
{&lt;br /&gt;
c[i][j]= a[i][j]+b[i][j];&lt;br /&gt;
}&lt;br /&gt;
printf(&quot;\n&quot;);&lt;br /&gt;
}&lt;br /&gt;
write_matrix(c,r1,c1);&lt;br /&gt;
break;&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 2:&lt;br /&gt;
printf(&quot;Input rows and columns of A matrix:&quot;);&lt;br /&gt;
scanf(&quot;%d%d&quot;,&amp;amp;m,&amp;amp;n);&lt;br /&gt;
printf(&quot;Input rows and columns of B matrix:&quot;);&lt;br /&gt;
scanf(&quot;%d%d&quot;,&amp;amp;p,&amp;amp;q);&lt;br /&gt;
if(n==p)&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;resultant matrix is %d*%d\n&quot;,m,q);&lt;br /&gt;
printf(&quot;Input A matrix\n&quot;);&lt;br /&gt;
read_matrix(a,m,n);&lt;br /&gt;
printf(&quot;Input B matrix\n&quot;);&lt;br /&gt;
/*Function call to read the matrix*/&lt;br /&gt;
read_matrix(b,p,q);&lt;br /&gt;
/*Function for Multiplication of two matrices*/&lt;br /&gt;
printf(&quot;\n =====Matrix Multiplication=====\n&quot;);&lt;br /&gt;
for(i=0;i&amp;lt;m;++i)&lt;br /&gt;
for(j=0;j&amp;lt;q;++j)&lt;br /&gt;
{&lt;br /&gt;
c[i][j]=0;&lt;br /&gt;
for(k=0;k&amp;lt;n;++k)&lt;br /&gt;
c[i][j]=c[i][j]+a[i][k]*b[k][j];&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;Resultant of two matrices:\n&quot;);&lt;br /&gt;
write_matrix(c,m,q);&lt;br /&gt;
}&lt;br /&gt;
/*end if*/&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;Matrices cannot be multiplied.&quot;);&lt;br /&gt;
}&lt;br /&gt;
/*end else*/&lt;br /&gt;
break;&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 0:&lt;br /&gt;
printf(&quot;\n Choice Terminated&quot;);&lt;br /&gt;
exit();&lt;br /&gt;
break;&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/*Function read matrix*/&lt;br /&gt;
int read_matrix(int a[10][10],int m,int n)&lt;br /&gt;
{&lt;br /&gt;
int i,j;&lt;br /&gt;
for(i=0;i&amp;lt;m;i++)&lt;br /&gt;
for(j=0;j&amp;lt;n;j++)&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;a[i][j]);&lt;br /&gt;
return 0;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/*Function to write the matrix*/&lt;br /&gt;
int write_matrix(int a[10][10],int m,int n)&lt;br /&gt;
{&lt;br /&gt;
int i,j;&lt;br /&gt;
for(i=0;i&amp;lt;m;i++)&lt;br /&gt;
{&lt;br /&gt;
for(j=0;j&amp;lt;n;j++)&lt;br /&gt;
printf(&quot;%5d&quot;,a[i][j]);&lt;br /&gt;
printf(&quot;\n&quot;);&lt;br /&gt;
}&lt;br /&gt;
return 0;&lt;br /&gt;
}&lt;br /&gt;
/*&lt;br /&gt;
Output:&lt;br /&gt;
************************************&lt;br /&gt;
MENU&lt;br /&gt;
**********************************&lt;br /&gt;
[1]ADDITION OF TWO MATRICES&lt;br /&gt;
[2]MULTIPLICATION OF TWO MATRICES&lt;br /&gt;
[0]EXIT&lt;br /&gt;
**********************************&lt;br /&gt;
Enter your choice:&lt;br /&gt;
1&lt;br /&gt;
Input rows and columns of A &amp;amp; B Matrix:2 2&lt;br /&gt;
Enter elements of matrix A:&lt;br /&gt;
3 4&lt;br /&gt;
2 3&lt;br /&gt;
Enter elements of matrix B:&lt;br /&gt;
2 1&lt;br /&gt;
3 21&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;=====Matrix Addition=====&lt;/div&gt;&lt;div style=&quot;font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;5 5&lt;br /&gt;
5 24&lt;br /&gt;
*/&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/8235805370449389598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-that-uses-functions-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/8235805370449389598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/8235805370449389598'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-that-uses-functions-to.html' title='Write a C program that uses functions to perform the following...'/><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-6465526636981825723.post-4142234298582187911</id><published>2011-04-23T07:04:00.001-07:00</published><updated>2011-04-23T07:04:46.806-07:00</updated><title type='text'>Write a C program to find both the larges and smallest number in a list of integers.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 983px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;main( )&lt;br /&gt;
{&lt;br /&gt;
int largest(float a[ ], int n);&lt;br /&gt;
int value[6] = {2,45,1,2,3,67};&lt;br /&gt;
printf(&quot; The largest %d\n&quot;, largest(value,6));&lt;br /&gt;
printf(&quot; smallest integer : %d\n&quot;,smallest(value,6));&lt;br /&gt;
}&lt;br /&gt;
int largest(int a[], int n)&lt;br /&gt;
{&lt;br /&gt;
int i;&lt;br /&gt;
int max;&lt;br /&gt;
max = a[0];&lt;br /&gt;
for(i = 1; i &amp;lt; n; i++)&lt;br /&gt;
if(max &amp;lt; a[i])&lt;br /&gt;
max = a[i];&lt;br /&gt;
return(max);&lt;br /&gt;
}&lt;br /&gt;
int smallest(int b[],int n)&lt;br /&gt;
{&lt;br /&gt;
int i;&lt;br /&gt;
int min;&lt;br /&gt;
min=a[0];&lt;br /&gt;
for(i = 1; i &amp;lt; n; i++)&lt;br /&gt;
if(min &amp;gt; a[i])&lt;br /&gt;
min=a[i];&lt;br /&gt;
return(min);&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/*&lt;br /&gt;
The largest 67&lt;br /&gt;
smallest integer : 1&lt;br /&gt;
*/&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/4142234298582187911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-both-larges-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4142234298582187911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4142234298582187911'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-both-larges-and.html' title='Write a C program to find both the larges and smallest number in a list of integers.'/><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-6465526636981825723.post-4533216242533227758</id><published>2011-04-23T07:03:00.000-07:00</published><updated>2011-04-23T07:03:45.399-07:00</updated><title type='text'>Write a C program, which takes two integer operands and one operator form the user.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Write a C program, which takes two integer operands and one operator form the user, performs the operation and then prints the result. (Consider the operators +,-,*, /, % and use Switch Statement)&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 2350px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td height=&quot;1004&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int a,b,res,ch;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;\t *********************&quot;);&lt;br /&gt;
printf(&quot;\n\tMENU\n&quot;);&lt;br /&gt;
printf(&quot;\t********************&quot;);&lt;br /&gt;
printf(&quot;\n\t(1)ADDITION&quot;);&lt;br /&gt;
printf(&quot;\n\t(2)SUBTRACTION&quot;);&lt;br /&gt;
printf(&quot;\n\t(3)MULTIPLICATION&quot;);&lt;br /&gt;
printf(&quot;\n\t(4)DIVISION&quot;);&lt;br /&gt;
printf(&quot;\n\t(5)REMAINDER&quot;);&lt;br /&gt;
printf(&quot;\n\t(0)EXIT&quot;);&lt;br /&gt;
printf(&quot;\n\t********************&quot;);&lt;br /&gt;
printf(&quot;\n\n\tEnter your choice:&quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;ch);&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;if(ch&amp;lt;=5 &amp;amp; ch&amp;gt;0)&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;Enter two numbers:\n&quot;);&lt;br /&gt;
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;switch(ch)&lt;br /&gt;
{&lt;/div&gt;&lt;blockquote style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 1em; padding-left: 15px; padding-right: 40px; padding-top: 1em;&quot;&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
case 1:&lt;br /&gt;
res=a+b;&lt;br /&gt;
printf(&quot;\n Addition:%d&quot;,res);&lt;br /&gt;
break;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 2:&lt;br /&gt;
res=a-b;&lt;br /&gt;
printf(&quot;\n Subtraction:%d&quot;,res);&lt;br /&gt;
break;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 3:&lt;br /&gt;
res=a*b;&lt;br /&gt;
printf(&quot;\n Multiplication:%d&quot;,res);&lt;br /&gt;
break;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 4:&lt;br /&gt;
res=a/b;&lt;br /&gt;
printf(&quot;\n Division:%d&quot;,res);&lt;br /&gt;
break;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 5:&lt;br /&gt;
res=a%b;&lt;br /&gt;
printf(&quot;\n Remainder:%d&quot;,res);&lt;br /&gt;
break;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;case 0:&lt;br /&gt;
printf(&quot;\n Choice Terminated&quot;);&lt;br /&gt;
exit();&lt;br /&gt;
break;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;default:&lt;br /&gt;
printf(&quot;\n Invalid Choice&quot;);&lt;/div&gt;&lt;/blockquote&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;strong&gt;/*&lt;/strong&gt;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;*********************&lt;br /&gt;
MENU&lt;br /&gt;
********************&lt;br /&gt;
(1)ADDITION&lt;br /&gt;
(2)SUBTRACTION&lt;br /&gt;
(3)MULTIPLICATION&lt;br /&gt;
(4)DIVISION&lt;br /&gt;
(5)REMAINDER&lt;br /&gt;
(0)EXIT&lt;br /&gt;
********************&lt;/strong&gt;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;Enter your choice:1&lt;br /&gt;
Enter two numbers:&lt;br /&gt;
2 3&lt;/strong&gt;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;Addition:5&lt;/strong&gt;&lt;/div&gt;&lt;div class=&quot;style1&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;*/&lt;/strong&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/4533216242533227758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-which-takes-two-integer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4533216242533227758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4533216242533227758'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-which-takes-two-integer.html' title='Write a C program, which takes two integer operands and one operator form the user.'/><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-6465526636981825723.post-1438683263823402180</id><published>2011-04-23T07:01:00.000-07:00</published><updated>2011-04-23T07:01:50.077-07:00</updated><title type='text'>Write C program to find the distance travelled at regular intervals of time</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;The total distance travelled by vehicle in ‘t’ seconds is given by distance = ut+1/2at2 where ‘u’ and ‘a’ are the initial velocity (m/sec.) and acceleration (m/sec2). Write C program to find the distance travelled at regular intervals of time given the values of ‘u’ and ‘a’. The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of ‘u’ and ‘a’.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; font-weight: normal; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1454px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td height=&quot;1004&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int tim_intrval, counter,time;&lt;br /&gt;
float accl, distance=0, velos;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;PROGRAM FOR CALC TOTAL DISTANCE TRAVELED BY A VECHIAL&quot;);&lt;br /&gt;
printf(&quot;\nNO OF TIME INTERVALS : &quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;tim_intrval);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;for(counter = 1; counter &amp;lt;= tim_intrval; counter++)&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;\nAT T%d TIME(sec) : &quot;,counter);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;time);&lt;br /&gt;
printf(&quot;\tVELOCITY AT %d sec (m/sec) : &quot;,time);&lt;br /&gt;
scanf(&quot;%f&quot;,&amp;amp;velos);&lt;br /&gt;
printf(&quot;\tACCLERATION AT %d sec (m/sec^2): &quot;,time);&lt;br /&gt;
scanf(&quot;%f&quot;,&amp;amp;accl);&lt;br /&gt;
distance += (velos*time + (accl*pow(time,2))/2);&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;\nTOTAL DISTANCE TRAVELLED BY VEHICLE IN %d INTERVALS OF TIME : %f&quot;,tim_intrval,distance);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;strong&gt;/*&lt;br /&gt;
Output:&lt;br /&gt;
PROGRAM FOR CALC TOTAL DISTANCE TRAVELED BY A VECHIAL&lt;br /&gt;
NO OF TIME INTERVALS : 4&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;AT T1 TIME(sec) : 1&lt;br /&gt;
VELOCITY AT 1 sec (m/sec) : 2&lt;br /&gt;
ACCLERATION AT 1 sec (m/sec^2): 3&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;AT T2 TIME(sec) : 4&lt;br /&gt;
VELOCITY AT 4 sec (m/sec) : 5&lt;br /&gt;
ACCLERATION AT 4 sec (m/sec^2): 6&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;AT T3 TIME(sec) : 7&lt;br /&gt;
VELOCITY AT 7 sec (m/sec) : 8&lt;br /&gt;
ACCLERATION AT 7 sec (m/sec^2): 8&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;AT T4 TIME(sec) : 9&lt;br /&gt;
VELOCITY AT 9 sec (m/sec) : 9&lt;br /&gt;
ACCLERATION AT 9 sec (m/sec^2): 0&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;TOTAL DISTANCE TRAVELLED BY VEHICLE IN 4 INTERVALS OF TIME : 404.500000&lt;br /&gt;
*/&lt;/strong&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/1438683263823402180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-distance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/1438683263823402180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/1438683263823402180'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-distance.html' title='Write C program to find the distance travelled at regular intervals of time'/><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-6465526636981825723.post-5035840805235835072</id><published>2011-04-23T07:00:00.000-07:00</published><updated>2011-04-23T07:00:06.852-07:00</updated><title type='text'>Write C programs that use both recursive and non-recursive functions To solve Towers of Hanoi problem</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 2401px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td height=&quot;1004&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Non-Recursive Function*/&lt;br /&gt;
void hanoiNonRecursion(int num,char sndl,char indl,char dndl)&lt;br /&gt;
{&lt;br /&gt;
char stkn[100],stksndl[100],stkindl[100],stkdndl[100],stkadd[100],temp;&lt;br /&gt;
int top,add;&lt;br /&gt;
top=NULL;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;one:&lt;br /&gt;
if(num==1)&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;\nMove top disk from needle %c to needle %c &quot;,sndl,dndl);&lt;br /&gt;
goto four;&lt;br /&gt;
}&lt;br /&gt;
two:&lt;br /&gt;
top=top+1;&lt;br /&gt;
stkn[top]=num;&lt;br /&gt;
stksndl[top]=sndl;&lt;br /&gt;
stkindl[top]=indl;&lt;br /&gt;
stkdndl[top]=dndl;&lt;br /&gt;
stkadd[top]=3;&lt;br /&gt;
num=num-1;&lt;br /&gt;
sndl=sndl;&lt;br /&gt;
temp=indl;&lt;br /&gt;
indl=dndl;&lt;br /&gt;
dndl=temp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;goto one;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;three:&lt;br /&gt;
printf(&quot;\nMove top disk from needle %c to needle %c &quot;,sndl,dndl);&lt;br /&gt;
top=top+1;&lt;br /&gt;
stkn[top]=num;&lt;br /&gt;
stksndl[top]=sndl;&lt;br /&gt;
stkindl[top]=indl;&lt;br /&gt;
stkdndl[top]=dndl;&lt;br /&gt;
stkadd[top]=5;&lt;br /&gt;
num=num-1;&lt;br /&gt;
temp=sndl;&lt;br /&gt;
sndl=indl;&lt;br /&gt;
indl=temp;&lt;br /&gt;
dndl=dndl;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;goto one;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;four:&lt;br /&gt;
if(top==NULL)&lt;br /&gt;
return;&lt;br /&gt;
num=stkn[top];&lt;br /&gt;
sndl=stksndl[top];&lt;br /&gt;
indl=stkindl[top];&lt;br /&gt;
dndl=stkdndl[top];&lt;br /&gt;
add=stkadd[top];&lt;br /&gt;
top=top-1;&lt;br /&gt;
if(add==3)&lt;br /&gt;
goto three;&lt;br /&gt;
else if(add==5)&lt;br /&gt;
goto four;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Recursive Function*/&lt;br /&gt;
void hanoiRecursion( int num,char ndl1, char ndl2, char ndl3)&lt;br /&gt;
{&lt;br /&gt;
if ( num == 1 ) {&lt;br /&gt;
printf( &quot;Move top disk from needle %c to needle %c.&quot;, ndl1, ndl2 );&lt;br /&gt;
return;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;hanoiRecursion( num - 1,ndl1, ndl3, ndl2 );&lt;br /&gt;
printf( &quot;Move top disk from needle %c to needle %c.&quot;, ndl1, ndl2 );&lt;br /&gt;
hanoiRecursion( num - 1,ndl3, ndl2, ndl1 );&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int no;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;Enter the no. of disks to be transferred: &quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;no);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;if(no&amp;lt;1)&lt;br /&gt;
printf(&quot;\nThere&#39;s nothing to move.&quot;);&lt;br /&gt;
else&lt;br /&gt;
printf(&quot;Non-Recursive&quot;);&lt;br /&gt;
hanoiNonRecursion(no,&#39;A&#39;,&#39;B&#39;,&#39;C&#39;);&lt;br /&gt;
printf(&quot;\nRecursive\n&quot;);&lt;br /&gt;
hanoiRecursion(no,&#39;A&#39;,&#39;B&#39;,&#39;C&#39;);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;getch();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;br /&gt;
/*&lt;br /&gt;
Output:&lt;/div&gt;Enter the no. of disks to be transferred: 3&lt;br /&gt;
Non-Recursive&lt;br /&gt;
Move top disk from needle A to needle C&lt;br /&gt;
Move top disk from needle A to needle B&lt;br /&gt;
Move top disk from needle C to needle B&lt;br /&gt;
Move top disk from needle A to needle C&lt;br /&gt;
Move top disk from needle B to needle A&lt;br /&gt;
Move top disk from needle B to needle C&lt;br /&gt;
Move top disk from needle A to needle C&lt;br /&gt;
Recursive&lt;br /&gt;
Move top disk from needle A to needle B.Move top disk from needle A to needle C.&lt;br /&gt;
Move top disk from needle B to needle C.Move top disk from needle A to needle B.&lt;br /&gt;
Move top disk from needle C to needle A.Move top disk from needle C to needle B.&lt;br /&gt;
Move top disk from needle A to needle B.&lt;br /&gt;
*/&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/5035840805235835072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-programs-that-use-both_4273.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/5035840805235835072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/5035840805235835072'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-programs-that-use-both_4273.html' title='Write C programs that use both recursive and non-recursive functions To solve Towers of Hanoi problem'/><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-6465526636981825723.post-4651339849440286741</id><published>2011-04-23T06:58:00.001-07:00</published><updated>2011-04-23T06:58:46.336-07:00</updated><title type='text'>Write C programs that use both recursive and non-recursive functions To find the GCD (greatest common divisor) of two given integers.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://www.beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td height=&quot;1004&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;math.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;unsigned int GcdRecursive(unsigned m, unsigned n);&lt;br /&gt;
unsigned int GcdNonRecursive(unsigned p,unsigned q);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;int main(void)&lt;br /&gt;
{&lt;br /&gt;
int a,b,iGcd;&lt;br /&gt;
clrscr();&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;Enter the two numbers whose GCD is to be found: &quot;);&lt;br /&gt;
scanf(&quot;%d%d&quot;,&amp;amp;a,&amp;amp;b);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;GCD of %d and %d Using Recursive Function is %d\n&quot;,a,b,GcdRecursive(a,b));&lt;br /&gt;
printf(&quot;GCD of %d and %d Using Non-Recursive Function is %d\n&quot;,a,b,GcdNonRecursive(a,b));&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Recursive Function*/&lt;br /&gt;
unsigned int GcdRecursive(unsigned m, unsigned n)&lt;br /&gt;
{&lt;br /&gt;
if(n&amp;gt;m)&lt;br /&gt;
return GcdRecursive(n,m);&lt;br /&gt;
if(n==0)&lt;br /&gt;
return m;&lt;br /&gt;
else&lt;br /&gt;
return GcdRecursive(n,m%n);&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Non-Recursive Function*/&lt;br /&gt;
unsigned int GcdNonRecursive(unsigned p,unsigned q)&lt;br /&gt;
{&lt;br /&gt;
unsigned remainder;&lt;br /&gt;
int temp;&lt;br /&gt;
while(1)&lt;br /&gt;
{&lt;br /&gt;
if(p == 0)&lt;br /&gt;
{&lt;br /&gt;
return q;&lt;br /&gt;
}&lt;br /&gt;
else if(q == 0)&lt;br /&gt;
{&lt;br /&gt;
return p;&lt;br /&gt;
}&lt;br /&gt;
else if(q&amp;lt;p)&lt;br /&gt;
{&lt;br /&gt;
temp=p%q;&lt;br /&gt;
p=temp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;br /&gt;
else if(p&amp;lt;q)&lt;br /&gt;
{&lt;br /&gt;
temp=q%p;&lt;br /&gt;
q=temp;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;br /&gt;
}&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/4651339849440286741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-programs-that-use-both_23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4651339849440286741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/4651339849440286741'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-programs-that-use-both_23.html' title='Write C programs that use both recursive and non-recursive functions To find the GCD (greatest common divisor) of two given integers.'/><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-6465526636981825723.post-2723747323208296336</id><published>2011-04-23T06:57:00.000-07:00</published><updated>2011-04-23T06:57:15.003-07:00</updated><title type='text'>Write C programs that use both recursive and non-recursive functions To find the factorial of a given integer</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; height: 1293px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px; text-align: -webkit-auto;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: #515756; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1293px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td height=&quot;1004&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;unsigned int recr_factorial(int n);&lt;br /&gt;
unsigned int iter_factorial(int n);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int n,i;&lt;br /&gt;
long fact;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;Enter the number: &quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;n);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;if(n==0)&lt;br /&gt;
printf(&quot;Factorial of 0 is 1\n&quot;);&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
printf(&quot;Factorial of %d Using Recursive Function is %d\n&quot;,n,recr_factorial(n));&lt;br /&gt;
printf(&quot;Factorial of %d Using Non-Recursive Function is %d\n&quot;,n,iter_factorial(n));&lt;br /&gt;
}&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Recursive Function*/&lt;br /&gt;
unsigned int recr_factorial(int n) {&lt;br /&gt;
return n&amp;gt;=1 ? n * recr_factorial(n-1) : 1;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/* Non-Recursive Function*/&lt;br /&gt;
unsigned int iter_factorial(int n) {&lt;br /&gt;
int accu = 1;&lt;br /&gt;
int i;&lt;br /&gt;
for(i = 1; i &amp;lt;= n; i++) {&lt;br /&gt;
accu *= i;&lt;br /&gt;
}&lt;br /&gt;
return accu;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;Out put :&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;&lt;br /&gt;
Enter the number: 5&lt;br /&gt;
Factorial of 5 Using Recursive Function is 120&lt;br /&gt;
Factorial of 5 Using Non-Recursive Function is 120&lt;/strong&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/2723747323208296336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-programs-that-use-both.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/2723747323208296336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/2723747323208296336'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-programs-that-use-both.html' title='Write C programs that use both recursive and non-recursive functions To find the factorial of a given integer'/><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-6465526636981825723.post-8566475005008358629</id><published>2011-04-23T06:47:00.000-07:00</published><updated>2011-04-23T06:47:44.057-07:00</updated><title type='text'>Write a C program to find the roots of a quadratic equation.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1038px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;math.h&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
float a,b,c,root1,root2;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;\n Enter values of a,b,c for finding roots of a quadratic (ax2+bx+c)eq:\n&quot;);&lt;br /&gt;
scanf(&quot;%f%f%f&quot;,&amp;amp;a,&amp;amp;b,&amp;amp;c);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;/*checking condition*/&lt;br /&gt;
if(b*b&amp;gt;4*a*c)&lt;br /&gt;
{&lt;br /&gt;
root1=(-b+sqrt(b*b-4*a*c))/(2*a);&lt;br /&gt;
root2=(-b-sqrt(b*b-4*a*c))/(2*a);&lt;br /&gt;
printf(&quot;\nROOTS ARE\n&quot;);&lt;br /&gt;
printf(&quot;\n root1=%f\n root2=%f&quot;,root1,root2);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
printf(&quot;\n Imaginary Roots.&quot;);&lt;br /&gt;
getch();&lt;br /&gt;
return 0;&lt;br /&gt;
}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
OutPut:&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;Enter values of a,b,c for finding roots of a quadratic (ax2+bx+c)eq:&lt;br /&gt;
2 -7 5&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;ROOTS ARE&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;strong&gt;root1=2.500000&lt;br /&gt;
root2=1.000000&lt;br /&gt;
&lt;/strong&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/8566475005008358629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-roots-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/8566475005008358629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/8566475005008358629'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-roots-of.html' title='Write a C program to find the roots of a quadratic equation.'/><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-6465526636981825723.post-645624758991654760</id><published>2011-04-23T06:41:00.000-07:00</published><updated>2011-04-23T06:41:13.495-07:00</updated><title type='text'>Write a C program to calculate the following Sum: Sum=1-x2/2! +x4/4!-x6/6!+x8/8!-x10/10!</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1162px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;/div&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int counter,f_coun;&lt;br /&gt;
float sum=0,x,power,fact;&lt;br /&gt;
clrscr();&lt;/div&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;PROGRAM FOR SUM OF EQ. SERIES&quot;);&lt;br /&gt;
printf(&quot;\n\n\tEQUATION SERIES : 1- X^2/2! + X^4/4! - X^6/6! + X^8/8! - X^10/10!&quot;);&lt;/div&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;\n\tENTER VALUE OF X : &quot;);&lt;br /&gt;
scanf(&quot;%f&quot;,&amp;amp;x);&lt;/div&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;for(counter=0, power=0; power&amp;lt;=10; counter++,power=power+2)&lt;br /&gt;
{&lt;br /&gt;
fact=1;&lt;br /&gt;
//CALC FACTORIAL OF POWER VALUE&lt;br /&gt;
for(f_coun=power; f_coun&amp;gt;=1; f_coun--)&lt;br /&gt;
fact *= f_coun;&lt;br /&gt;
//EQ. FOR SUM SERIES&lt;br /&gt;
sum=sum+(pow(-1,counter)*(pow(x,power)/fact));&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;SUM : %f&quot;,sum);&lt;br /&gt;
getch();&lt;/div&gt;&lt;div class=&quot;style9&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;PROGRAM FOR SUM OF EQ. SERIES&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;EQUATION SERIES : 1- X^2/2! + X^4/4! - X^6/6! + X^8/8! - X^10/10!&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;ENTER VALUE OF X : 4&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;SUM : -0.685785&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/645624758991654760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-calculate-following.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/645624758991654760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/645624758991654760'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-calculate-following.html' title='Write a C program to calculate the following Sum: Sum=1-x2/2! +x4/4!-x6/6!+x8/8!-x10/10!'/><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-6465526636981825723.post-1340804346693590418</id><published>2011-04-23T06:33:00.000-07:00</published><updated>2011-04-23T06:33:14.183-07:00</updated><title type='text'>Write a C program to generate all the prime numbers between 1 and n.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1105px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int no,counter,counter1,check;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;PRIME NO. SERIES&quot;);&lt;br /&gt;
printf(&quot;\nINPUT THE VALUE OF N: &quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;no);&lt;br /&gt;
printf(&quot;\nTHE PRIME NO. SERIES B/W 1 TO %d : \n\n&quot;,no);&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;for(counter = 1; counter &amp;lt;= no; counter++)&lt;br /&gt;
{&lt;br /&gt;
check = 0;&lt;br /&gt;
//THIS LOOP WILL CHECK A NO TO BE PRIME NO. OR NOT.&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;for(counter1 = counter-1; counter1 &amp;gt; 1 ; counter1--)&lt;br /&gt;
if(counter%counter1 == 0)&lt;br /&gt;
{&lt;br /&gt;
check++; // INCREMENT CHECK IF NO. IS NOT A PRIME NO.&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
if(check == 0)&lt;br /&gt;
printf(&quot;%d\t&quot;,counter);&lt;br /&gt;
}&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
PRIME NO. SERIES&lt;br /&gt;
INPUT THE VALUE OF N: 25&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;THE PRIME NO. SERIES B/W 1 TO 25 :&lt;/div&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;1 2 3 5 7 11 13 17 19 23&lt;br /&gt;
&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/1340804346693590418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-generate-all-prime.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/1340804346693590418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/1340804346693590418'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-generate-all-prime.html' title='Write a C program to generate all the prime numbers between 1 and n.'/><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-6465526636981825723.post-9080480938995703048</id><published>2011-04-23T06:26:00.000-07:00</published><updated>2011-04-23T06:26:37.347-07:00</updated><title type='text'>Write a C program to Fibonacci Sequence..</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;&amp;nbsp;A Fibonacci Sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent terms are found by adding the preceding two terms in the sequence. Write a C program to generate the first n terms of the sequence.&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; font-weight: normal; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 1027px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int num1=0, num2=1,no,counter,fab;&lt;br /&gt;
clrscr();&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;PROGRAM TO FIND THE FIBONACCI SERIES UP TO N NO. IN SERIES&quot;);&lt;br /&gt;
printf(&quot;\nENTER LENGTH OF SERIES (N) : &quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;no);&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;printf(&quot;\nFIBONACCI SERIES&quot;);&lt;br /&gt;
printf(&quot;\t%d %d&quot;,num1,num2);&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;//LOOP WILL RUN FOR 2 TIME LESS IN SERIES AS THESE WAS PRINTED IN ADVANCE&lt;br /&gt;
for(counter = 1; counter &amp;lt;= no-2; counter++)&lt;br /&gt;
{&lt;br /&gt;
fab=num1 + num2;&lt;br /&gt;
printf(&quot; %d&quot;,fab);&lt;br /&gt;
num1=num2;&lt;br /&gt;
num2=fab;&lt;br /&gt;
}&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;color: blue; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;color: blue; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;PROGRAM TO FIND THE FIBONACCI SERIES UP TO N NO. IN SERIES&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;color: blue; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;ENTER LENGTH OF SERIES (N) : 5&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;div class=&quot;style2&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;style7&quot; style=&quot;font-size: 12px;&quot;&gt;FIBONACCI SERIES 0 1 1 2 3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;style7&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/9080480938995703048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-fibonacci-sequence.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/9080480938995703048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/9080480938995703048'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-fibonacci-sequence.html' title='Write a C program to Fibonacci Sequence..'/><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-6465526636981825723.post-2862522528422816886</id><published>2011-04-23T06:08:00.000-07:00</published><updated>2011-04-23T06:08:27.706-07:00</updated><title type='text'>Write a C program to find the sum of individual digits of a positive integer.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #515756; font-family: &#39;Lucida Grande&#39;, Arial, sans-serif; font-size: 12px; line-height: 19px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;ja-containerwrap&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/grad1.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; font-size: 12px; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 25px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div id=&quot;ja-container&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/main-bg1.gif); background-origin: initial; background-position: 0% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(231, 232, 230); border-top-style: solid; border-top-width: 1px; clear: both; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-container2&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://qa.beginnerslibrary.com/templates/ja_edenite/images/main-bg2.gif); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat repeat; border-bottom-color: rgb(231, 232, 230); border-bottom-style: solid; border-bottom-width: 1px; font-size: 12px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-mainbody&quot; style=&quot;font-size: 12px; width: 760px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-content&quot; style=&quot;clear: both; display: block; font-size: 12px; height: 816px; width: 570px;&quot;&gt;&lt;div class=&quot;clearfix&quot; id=&quot;ja-current-content&quot; style=&quot;font-size: 12px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;&quot;&gt;&lt;table class=&quot;contentpaneopen&quot; style=&quot;-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 552px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;font-size: 12px;&quot; valign=&quot;top&quot;&gt;&lt;table border=&quot;0&quot; style=&quot;width: 550px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;void main()&lt;br /&gt;
{&lt;br /&gt;
int num, k=1, sum=0;&lt;br /&gt;
clrscr();&lt;br /&gt;
printf(&quot;Enter the number whose digits are to be added:&quot;);&lt;br /&gt;
scanf(&quot;%d&quot;,&amp;amp;num);&lt;br /&gt;
while(num!=0)&lt;br /&gt;
{&lt;br /&gt;
k=num%10;&lt;br /&gt;
sum=sum+k;&lt;br /&gt;
k=num/10;&lt;br /&gt;
num=k;&lt;br /&gt;
}&lt;br /&gt;
printf(&quot;Sum of the digits:%d&quot;,sum);&lt;br /&gt;
getch();&lt;br /&gt;
}&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;style7&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;style7&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Enter the number whose digits are to be added:567&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;style3&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;style7&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Sum of the digits:18&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinucprograms.blogspot.com/feeds/2862522528422816886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-sum-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/2862522528422816886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6465526636981825723/posts/default/2862522528422816886'/><link rel='alternate' type='text/html' href='http://vinucprograms.blogspot.com/2011/04/write-c-program-to-find-sum-of.html' title='Write a C program to find the sum of individual digits of a positive integer.'/><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></feed>