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

<channel>
	<title>switch case example in c - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/switch-case-example-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/switch-case-example-in-c/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Mon, 03 Oct 2022 07:00:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>switch case example in c - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/switch-case-example-in-c/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is Switch Statement in C with example ?</title>
		<link>https://www.wikitechy.com/interview-questions/c/what-is-switch-statement-in-c-with-example/</link>
					<comments>https://www.wikitechy.com/interview-questions/c/what-is-switch-statement-in-c-with-example/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Mon, 03 Oct 2022 06:56:02 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[c switch statement]]></category>
		<category><![CDATA[example of switch statement]]></category>
		<category><![CDATA[switch case example in c]]></category>
		<category><![CDATA[switch case in c]]></category>
		<category><![CDATA[switch case in c programming examples]]></category>
		<category><![CDATA[switch case in c programming questions]]></category>
		<category><![CDATA[switch statement in c++]]></category>
		<category><![CDATA[switch statement with examples]]></category>
		<category><![CDATA[switch--case in c programming]]></category>
		<category><![CDATA[syntax of switch statement]]></category>
		<category><![CDATA[what is switch in c language]]></category>
		<category><![CDATA[what is switch in c programming]]></category>
		<category><![CDATA[what is switch statement in c]]></category>
		<category><![CDATA[what is switch statement in c programming]]></category>
		<category><![CDATA[what is switch statement in c with example]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4911</guid>

					<description><![CDATA[Switch statement is an alternative to if else ladder statement which allows us to execute multiple operations for different values. We can define various statement in multiple cases for different values of single variable. Rules for switch statement Switch expression should be an integer or character data type. Case value must be an integer or [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul style="text-align: justify;">
<li style="text-align: justify;">Switch statement is an alternative to if else ladder statement which allows us to execute multiple operations for different values.</li>
<li>We can define various statement in multiple cases for different values of single variable.</li>
</ul>
<h2 id="rules-for-switch-statement" style="text-align: justify;">Rules for switch statement</h2>
<ul style="text-align: justify;">
<li>Switch expression should be an integer or character data type.</li>
<li>Case value must be an integer or constant value.</li>
<li>We can use only case value inside the switch statement.</li>
<li>Break statement is not mandatory in switch. It is optional.</li>
<li>If a program does not find a break statement in switch expression, all the cases in the switch will be executed along with the matched case.</li>
</ul>
<h2 id="syntax-for-switch-statement" style="text-align: justify;">Syntax for switch statement</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-c code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-c code-embed-code">switch(expression){    <br/>case value1:    <br/>//code to be executed;    <br/>break;  //optional  <br/>case value2:    <br/>//code to be executed;    <br/>break;  //optional  <br/>......    <br/>default:     <br/>code to be executed if all cases are not matched;    <br/>}    </code></pre> </div>
<h2 id="flow-chart-for-switch">Flow chart for switch</h2>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4913 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-statement-in-c.png" alt="" width="730" height="590" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-statement-in-c.png 730w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-statement-in-c-300x242.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-statement-in-c-390x315.png 390w" sizes="(max-width: 730px) 100vw, 730px" /></p>
<h2 id="sample-program">Sample Program</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-c code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-c code-embed-code">    #include&lt;stdio.h&gt;<br/><br/>    int main() {<br/>      int number = 0;<br/>      printf(&quot;enter a number:&quot;);<br/>      scanf(&quot;%d&quot;, &amp; number);<br/>      switch (number) {<br/>      case 10:<br/>        printf(&quot;number is equals to 10&quot;);<br/>        break;<br/>      case 50:<br/>        printf(&quot;number is equal to 50&quot;);<br/>        break;<br/>      case 100:<br/>        printf(&quot;number is equal to 100&quot;);<br/>        break;<br/>      default:<br/>        printf(&quot;number is not equal to 10, 50 or 100&quot;);<br/>      }<br/>      return 0;<br/>    }</code></pre> </div>
<h2 id="output">Output</h2>
<p><img decoding="async" class="alignnone size-full wp-image-4916 aligncenter" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-case-examples.jpg" alt="" width="329" height="182" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-case-examples.jpg 329w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/10/switch-case-examples-300x166.jpg 300w" sizes="(max-width: 329px) 100vw, 329px" /></p>
<p style="text-align: justify;">
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/c/what-is-switch-statement-in-c-with-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the output of this C code ? &#124; Recursive Function in C Program</title>
		<link>https://www.wikitechy.com/interview-questions/recursion-and-iteration/what-is-the-output-of-this-c-code-recursive-function-in-c-program/</link>
					<comments>https://www.wikitechy.com/interview-questions/recursion-and-iteration/what-is-the-output-of-this-c-code-recursive-function-in-c-program/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Sat, 28 Aug 2021 17:14:35 +0000</pubDate>
				<category><![CDATA[Recursion and Iteration]]></category>
		<category><![CDATA[algorithm for switch case in c]]></category>
		<category><![CDATA[c program for switch case using function]]></category>
		<category><![CDATA[C programming switch case examples]]></category>
		<category><![CDATA[C programming switch case Examples/Programs]]></category>
		<category><![CDATA[C programming switch case Programs]]></category>
		<category><![CDATA[C switch case Statement]]></category>
		<category><![CDATA[How does the switch and break work in C]]></category>
		<category><![CDATA[Java switch Statement]]></category>
		<category><![CDATA[Program for Switch Case with and without break statement]]></category>
		<category><![CDATA[switch case]]></category>
		<category><![CDATA[switch case c]]></category>
		<category><![CDATA[switch case example in c]]></category>
		<category><![CDATA[switch case exercises in c]]></category>
		<category><![CDATA[switch case in c programming examples]]></category>
		<category><![CDATA[switch case in c programming questions]]></category>
		<category><![CDATA[switch case program in c]]></category>
		<category><![CDATA[switch case statement in C Programming]]></category>
		<category><![CDATA[switch statement in c++]]></category>
		<category><![CDATA[TCS Ninja Coding Questions with Answers | TCS Ninja Coding Questions 2021 | TCS Ninja Programming MCQ Questions]]></category>
		<category><![CDATA[What is switch condition]]></category>
		<category><![CDATA[while c programming]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=2646</guid>

					<description><![CDATA[Answer : D. Error]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<p class="color-pink">What is the output of this C code ?</p>
<div class="CodeContent">
<div class="hddn">
<figure class="highlight">
<pre><code class="hljs bash" data-lang=""><span class="nt">Function <span class="hljs-function"><span class="hljs-title">main</span></span>() {
  <span class="hljs-built_in">integer</span> a = <span class="hljs-number">5</span>, b = <span class="hljs-number">7</span>
  Switch(a) {
    Case <span class="hljs-number">5</span>: <span class="hljs-built_in">print</span> <span class="hljs-string">"I am 5"</span>
    Break
    Case b: <span class="hljs-built_in">print</span> <span class="hljs-string">"I am not 5"</span>
    Break
    Default: <span class="hljs-built_in">print</span> <span class="hljs-string">"I am different"</span>
  }
}
</span></code></pre>
</figure>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<p>A. I am 5</p>
</div>
<div class="col-sm-4">
<p>B. I am not 5</p>
</div>
<div class="col-sm-4">
<p>C. I am different</p>
</div>
<div class="col-sm-4">
<p>D. Error</p>
</div>
<div class="col-sm-4">
<p>E. None of these</p>
</div>
</div>
</div>
</div>
<h3 id="answer-d-error"><b>Answer : </b>D. Error</h3>
<div class="subheading">
<h2 id="explanation">Explanation:</h2>
</div>
<div class="Content">
<div class="hddn">
<ul>
<li>Break doesn’t have &#8220;;&#8221; (Semi Colon missing in break command)</li>
</ul>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/recursion-and-iteration/what-is-the-output-of-this-c-code-recursive-function-in-c-program/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the output of this C code ?</title>
		<link>https://www.wikitechy.com/interview-questions/c/what-is-the-output-of-this-c-code/</link>
					<comments>https://www.wikitechy.com/interview-questions/c/what-is-the-output-of-this-c-code/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Mon, 12 Jul 2021 21:16:29 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Accentur interview questions and answers]]></category>
		<category><![CDATA[algorithm for switch case in c]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Asian Paints Ltd. interview questions and answers]]></category>
		<category><![CDATA[Bosch India Software interview questions and answers]]></category>
		<category><![CDATA[c program for switch case using function]]></category>
		<category><![CDATA[C programming switch case examples]]></category>
		<category><![CDATA[C programming switch case Examples/Programs]]></category>
		<category><![CDATA[C programming switch case Programs]]></category>
		<category><![CDATA[C switch case Statement]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Ciena Corporation interview questions and answers]]></category>
		<category><![CDATA[Collabera Technologies interview questions and answers]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[DHFL Pramerica Life Insurance Company Ltd interview questions and answers]]></category>
		<category><![CDATA[Elico HealthCare Services Ltd interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[HCL Technol interview questions and answers]]></category>
		<category><![CDATA[How does the switch and break work in C]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Java switch Statement]]></category>
		<category><![CDATA[Mavenir interview questions and answers]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Program for Switch Case with and without break statement]]></category>
		<category><![CDATA[R Systems interview questions and answers]]></category>
		<category><![CDATA[Raqmiyat Information Technologies Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Reliance Industries Ltd interview questions and answers]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[switch case]]></category>
		<category><![CDATA[switch case c]]></category>
		<category><![CDATA[switch case example in c]]></category>
		<category><![CDATA[switch case exercises in c]]></category>
		<category><![CDATA[switch case in c programming examples]]></category>
		<category><![CDATA[switch case in c programming questions]]></category>
		<category><![CDATA[switch case program in c]]></category>
		<category><![CDATA[switch case statement in C Programming]]></category>
		<category><![CDATA[switch caseswitch case statement in C Programming]]></category>
		<category><![CDATA[switch statement in c++]]></category>
		<category><![CDATA[Tata AIA Life Insurance interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindr interview questions and answers]]></category>
		<category><![CDATA[The Linde Group interview questions and answers]]></category>
		<category><![CDATA[What is switch condition]]></category>
		<category><![CDATA[while c programming]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=341</guid>

					<description><![CDATA[Answer : D. Error]]></description>
										<content:encoded><![CDATA[<h3 id="what-is-the-output-of-this-c-code">What is the output of this C code ?</h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-c code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-c code-embed-code">Function main() {<br/>  integer a = 5, b = 7<br/>  Switch(a) {<br/>    Case 5: print &quot;I am 5&quot;<br/>    Break<br/>    Case b: print &quot;I am not 5&quot;<br/>    Break<br/>    Default: print &quot;I am different&quot;<br/>  }<br/>}</code></pre> </div>
<div class="TextHeading">
<div class="hddn">
<div class="row">
<div class="col-sm-4">
<p>A. I am 5</p>
</div>
<div class="col-sm-4">
<p>B. I am not 5</p>
</div>
<div class="col-sm-4">
<p>C. I am different</p>
</div>
<div class="col-sm-4">
<p>D. Error</p>
</div>
<div class="col-sm-4">
<p>E. None of these</p>
</div>
</div>
</div>
</div>
<h3 id="answer-d-error"><b>Answer : </b>D. Error<u></u></h3>
<div class="subheading">
<h2 id="explanation">Explanation:</h2>
</div>
<div class="Content">
<div class="hddn">
<ul>
<li>Break doesn’t have &#8220;;&#8221; (Semi Colon missing in break command)</li>
</ul>
</div>
</div>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/c/what-is-the-output-of-this-c-code/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
