Program Kontrol Deyimleri Cevapları

1. Faktöriyel Hesabı

</p>
<p>#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
int sayi,fakt=1,i ;<br />
cout&lt;&lt;&quot;sayi giriniz&quot;&lt;&lt;endl;<br />
cin &gt;&gt;sayi;<br />
i=sayi;<br />
/*  for(sayi;sayi&gt;0;sayi--)<br />
fakt=fakt*sayi; */<br />
while(sayi &gt;0)<br />
fakt=fakt*sayi--;<br />
cout&lt;&lt;i &lt;&lt;&quot; sayısinin fakt: &quot; &lt;&lt;fakt&lt;&lt;endl;<br />
system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}</p>
<p>&amp;nbsp;&lt;/blockquote&gt;<br />
&lt;span style=&quot;color: #ffffff; font-size: small;&quot;&gt;2. Fonksiyon&lt;/span&gt;<br />
&lt;blockquote&gt;&amp;nbsp;</p>
<p>#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;math.h&gt;</p>
<p>using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
float x=0, f;</p>
<p>for(x=0; x&lt;=5.0; x+=0.2)<br />
{<br />
f = pow(x,3) + 5*pow(x,2) + 4*x - 3;<br />
cout &lt;&lt; &quot;f(&quot; &lt;&lt; x &lt;&lt; &quot;): &quot; &lt;&lt; f &lt;&lt; endl;</p>
<p>}<br />
system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}</p>
<p>&amp;nbsp;&lt;/blockquote&gt;<br />
&lt;span style=&quot;font-size: small;&quot;&gt;3. Finacci Serisi (1,2,3,5,8,13,21……..)&lt;/span&gt;<br />
&lt;blockquote&gt;#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
int kucuk=1,buyuk=2, toplam=0;<br />
while(buyuk+kucuk&lt;2000)<br />
{<br />
toplam=kucuk+buyuk;<br />
kucuk=buyuk;<br />
buyuk=toplam;<br />
cout&lt;&lt;toplam&lt;&lt;&quot; &quot;;<br />
}<br />
system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}</p>
<p>&amp;nbsp;&lt;/blockquote&gt;<br />
&lt;span style=&quot;color: #ffffff; font-size: small;&quot;&gt;4. Armstrong Sayıları ( abc = a^3 + b^3 + c^3)&lt;/span&gt;<br />
&lt;blockquote&gt;#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;math.h&gt;<br />
using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
int a,b,c,abc=100;<br />
while (abc&lt;1000)<br />
{<br />
a=abc/100;<br />
b=(abc%100)/10;<br />
c=abc%10;<br />
if (pow(a,3)+pow(b,3)+pow(c,3)==abc)<br />
cout&lt;&lt; abc &lt;&lt; &quot; sayisinin basamaklari &quot;&lt;&lt;a&lt;&lt; &quot; , &quot;&lt;&lt;b&lt;&lt; &quot; , &quot;&lt;&lt; c&lt;&lt; endl;<br />
abc++;<br />
}<br />
system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}</p>
<p>&amp;nbsp;&lt;/blockquote&gt;<br />
&lt;blockquote&gt;#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;math.h&gt;<br />
using namespace std;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
int a,b,c,d;</p>
<p>for(a=1; a&lt;=9; a++)<br />
for(b=0; b&lt;=9; b++)<br />
for(c=0; c&lt;=9; c++)<br />
for(d=0; d&lt;=9 ; d++)<br />
if(pow(a,4)+ pow(b,4)+ pow(c,4)== 1000*a + 100*b +10*c +d)<br />
cout &lt;&lt; a &lt;&lt; b &lt;&lt; c &lt;&lt; d &lt;&lt; &quot; &quot; ;<br />
system(&quot;PAUSE&quot;);<br />
return EXIT_SUCCESS;<br />
}</p>
<p>

Yorum Yapın

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d blogcu bunu beğendi: