<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Eine for-Schleife mit if else drinnen im if Teil weiterführen...]]></title><description><![CDATA[<p>Hey Leute ich habe ein Frage und zwar hab ich zwei for-Schleifen, in der einen for schleife habe ich eine if else abfrage eingebaut, jetzt möchte ich, dass beim if Teil, wenn dieser erfülllt ist, das Programm mit der for schleife weitermacht,kann mir jemand sagen, wie ich das hinbekomme? Also da wo jetzt continue steht sollte er wieder in die zweite for schleife springen...<br />
Danke schonmal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Gruß</p>
<p>Maxi</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;
int main(void)
{
	int n,t, prim;
	for (n = 2; n &lt;= 10000; n = n+1)
	{
		for (t = 2; t &lt;= n-1; t=t+1)
	{
	prim = n%t;

	if (prim!=0)
	{
--&gt;	continue;      &lt;--
	}
	else
        {
	printf(&quot;%d\n&quot;,n);
	break;			
}
}
}
return 0;
}
</code></pre>
<p>/edit pumuckl: cpp-Tags, demnächst bitte selbst machen!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/288003/eine-for-schleife-mit-if-else-drinnen-im-if-teil-weiterführen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 03:16:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/288003.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Jun 2011 15:56:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Fri, 10 Jun 2011 12:37:38 GMT]]></title><description><![CDATA[<p>Hey Leute ich habe ein Frage und zwar hab ich zwei for-Schleifen, in der einen for schleife habe ich eine if else abfrage eingebaut, jetzt möchte ich, dass beim if Teil, wenn dieser erfülllt ist, das Programm mit der for schleife weitermacht,kann mir jemand sagen, wie ich das hinbekomme? Also da wo jetzt continue steht sollte er wieder in die zweite for schleife springen...<br />
Danke schonmal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Gruß</p>
<p>Maxi</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;
int main(void)
{
	int n,t, prim;
	for (n = 2; n &lt;= 10000; n = n+1)
	{
		for (t = 2; t &lt;= n-1; t=t+1)
	{
	prim = n%t;

	if (prim!=0)
	{
--&gt;	continue;      &lt;--
	}
	else
        {
	printf(&quot;%d\n&quot;,n);
	break;			
}
}
}
return 0;
}
</code></pre>
<p>/edit pumuckl: cpp-Tags, demnächst bitte selbst machen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075295</guid><dc:creator><![CDATA[max.mitl]]></dc:creator><pubDate>Fri, 10 Jun 2011 12:37:38 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 15:59:19 GMT]]></title><description><![CDATA[<p>Was macht es denn mit continue?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075297</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075297</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 08 Jun 2011 15:59:19 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 16:03:01 GMT]]></title><description><![CDATA[<p>Also das hab ich nur reingeschrieben weil ich das irgendwo gelesen hab, aber er spuckt mir nur die zahlen bis 10000 aus...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075299</guid><dc:creator><![CDATA[max.mitl]]></dc:creator><pubDate>Wed, 08 Jun 2011 16:03:01 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 16:12:53 GMT]]></title><description><![CDATA[<p>max.mitl schrieb:</p>
<blockquote>
<p>Also das hab ich nur reingeschrieben weil ich das irgendwo gelesen hab, aber er spuckt mir nur die zahlen bis 10000 aus...</p>
</blockquote>
<p>Alle? Wo sollte sonst etwas ausgegeben werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075309</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 08 Jun 2011 16:12:53 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 17:38:38 GMT]]></title><description><![CDATA[<p>Also bei mir gehts los ab 9666...<br />
Also der Sinn von dem Programm sollte eigentlich sein, dass er mir alle Primzahlen am Bildschirm ausgibt und in der ersten schleife von 2 bis 10000 geht und in der zweiten von 2 bis n-1 und nun is es so, wenn die zahl n durch t teilbar ist, dann ist es keine Primzahl und wenn schon, dann nicht, aber irgendwie hab ich da wohl nen Fehler eingebaut....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075346</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075346</guid><dc:creator><![CDATA[max.mitl]]></dc:creator><pubDate>Wed, 08 Jun 2011 17:38:38 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 17:49:46 GMT]]></title><description><![CDATA[<p>Such mal nach &quot;Primzahl&quot; hier in diesem Subforum - es gibt einige Dutzend Beiträge dazu (und entsprechend viele Lösungen - dann siehst du deinen Fehler!).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075353</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Wed, 08 Jun 2011 17:49:46 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 17:57:51 GMT]]></title><description><![CDATA[<p>max.mitl schrieb:</p>
<blockquote>
<p>Also bei mir gehts los ab 9666..</p>
</blockquote>
<p>Mit dem continue?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075355</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075355</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 08 Jun 2011 17:57:51 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 18:10:30 GMT]]></title><description><![CDATA[<p>Ja mit dem continue...<br />
Ich weiß ja nichmal ob das stimmt, ich denk mal das programm an sich so sollte ja passen, ich weiß halt nur nich, wie ich dem sagen soll, dass er bei continue mit der zweiten schleife weitermacht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075361</guid><dc:creator><![CDATA[max.mitl]]></dc:creator><pubDate>Wed, 08 Jun 2011 18:10:30 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Wed, 08 Jun 2011 19:55:43 GMT]]></title><description><![CDATA[<p>Wenn ich deinen Code mit continue nehme erhalte ich folgende Ausgabe:</p>
<pre><code>4
6
8
9
10
12
14
15
16
18
20
21
22

usw.
</code></pre>
<p>Vielleicht solltest du dir die <strong>gesamte</strong> Ausgabe ansehen und nicht nur die letzten Zeilen? Man könnte auch erst nur bis 100 zählen ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2075426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2075426</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 08 Jun 2011 19:55:43 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Fri, 10 Jun 2011 12:21:12 GMT]]></title><description><![CDATA[<p>In deinem Quellcode wird jede Zahl die als Nicht-Primzahl identifiziert wird ausgegeben, irgendwie nicht das was du wolltest.<br />
Aber davon abgesehen sehe ich immer wieder, dass Leute ihre Standard For-schleife hinschreiben und erst dann überlegen was pssieren soll. So auch hier.<br />
Deine Primberechnung ist doch eigentlich Teil deiner Laufbedingung, ist die Schleife fertig kannst du abhängig von diesem Wert bestimmen ob du nü eine Primzahl hast oder nicht</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt; 
#include &lt;windows.h&gt; 
int main(void) 
{ 
int n,t, prim; 
for (n = 2; n &lt;= 10000; n = n+1) 
{ 
     for (t = 2; t &lt;= n-1 &amp;&amp;  n % t; t=t+1) 
     ;
     if(t &gt;= n-1)  // Groeser gleich für den Spezialfall n = 2, 2 ist ja auch ne primzahl
          printf(&quot;%d\n&quot;,n);
} 
return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2076312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2076312</guid><dc:creator><![CDATA[Ka-Mensch]]></dc:creator><pubDate>Fri, 10 Jun 2011 12:21:12 GMT</pubDate></item><item><title><![CDATA[Reply to Eine for-Schleife mit if else drinnen im if Teil weiterführen... on Fri, 10 Jun 2011 14:26:10 GMT]]></title><description><![CDATA[<p>Vielen Dank für die Hilfe!<br />
Dass ich da den grundäzlichen Fehler drinhatte hab ich bemerkt gehabt aber auf die Lösung wär ich nie gekommen, funktioniert jetzt einwandfrei! Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2076422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2076422</guid><dc:creator><![CDATA[max.mitl]]></dc:creator><pubDate>Fri, 10 Jun 2011 14:26:10 GMT</pubDate></item></channel></rss>