<?xml version="1.0"?>
<flowgorithm fileversion="2.11">
    <attributes>
        <attribute name="name" value=""/>
        <attribute name="authors" value="fox"/>
        <attribute name="about" value=""/>
        <attribute name="saved" value="2021-03-29 10:24:02 odp."/>
        <attribute name="created" value="Zm94O0RFU0tUT1AtQTRBVE1MRjsyMDIwLTA0LTA3OzEyOjEwOjA2IGRvcC47Mjg4Ng=="/>
        <attribute name="edited" value="Zm94O0RFU0tUT1AtQTRBVE1MRjsyMDIwLTA0LTA3OzA5OjQ0OjUxIG9kcC47MTA7MzA1NQ=="/>
        <attribute name="edited" value="Rm94O0RPTUFfREVMTzsyMDIxLTAzLTI5OzEwOjI0OjAyIG9kcC47MTsyNTY5"/>
    </attributes>
    <function name="Main" type="None" variable="">
        <parameters/>
        <body>
            <comment text="Deklarace: 'pocetCisel' ... po&#269;et prvo&#269;&#237;sel, kter&#225; maj&#237; b&#253;t vyps&#225;na; 'n' ... po&#269;et nalezen&#253;ch prvo&#269;&#237;sel; 'i' ... testovan&#233; &#269;&#237;slo na prvo&#269;&#237;slo (&#269;&#237;ta&#269;); 'vystup' ... textov&#225; prom&#283;nn&#225;, do kter&#233; budeme ukl&#225;dat v&#253;sledek"/>
            <declare name="pocetCisel, n, i" type="Integer" array="False" size=""/>
            <declare name="vystup" type="String" array="False" size=""/>
            <comment text="Inicializace - po&#269;et nalezen&#253;ch &#269;&#237;sel"/>
            <assign variable="n" expression="0"/>
            <comment text="Inicializace - &#269;&#237;slo testovan&#233; na prvo&#269;&#237;slo"/>
            <assign variable="i" expression="2"/>
            <assign variable="vystup" expression="&quot;&quot;"/>
            <output expression="&quot;V&#253;pis prvn&#237;ch n prvo&#269;&#237;sel&quot;" newline="True"/>
            <output expression="&quot;Zadejte po&#269;et vypsan&#253;ch prvo&#269;&#237;sel: &quot;" newline="False"/>
            <comment text="Na&#269;ten&#237; po&#269;tu vypisovan&#253;ch prvo&#269;&#237;sel"/>
            <input variable="pocetCisel"/>
            <comment text="Test na zad&#225;n&#237; z&#225;porn&#233;ho po&#269;tu vyp&#237;sovan&#253;ch prvo&#269;&#237;sel"/>
            <if expression="pocetCisel&lt;0">
                <then>
                    <output expression="&quot;Zadejte platnou kladnou celo&#269;&#237;selnou hodnotu pro po&#269;et &#269;&#237;sel.&quot;" newline="True"/>
                    <breakpoint/>
                </then>
                <else/>
            </if>
            <comment text="Cyklus - pokud plat&#237;, &#382;e je vyps&#225;no m&#233;n&#283; ne&#382; specifikovan&#253; po&#269;et prvo&#269;&#237;sel"/>
            <while expression="n &lt; pocetcisel">
                <comment text="Pokud n&#225;vrat zavolan&#233; funkce testu na prvo&#269;&#237;slo u testovan&#233;ho &#269;&#237;sla je pravda"/>
                <if expression="PrvoCislo(i)">
                    <then>
                        <comment text="Zv&#253;&#353;eni hodnoty poctu nalezen&#253;ch prvo&#269;&#237;sel o 1"/>
                        <assign variable="n" expression="n + 1"/>
                        <comment text="P&#345;ipojen&#237; &#269;&#237;slice (testovan&#233;ho &#269;&#237;sla konvertovan&#233;ho na text) k p&#345;edchoz&#237;m"/>
                        <assign variable="vystup" expression="vystup &amp; ToString(i)"/>
                        <comment text="Pokud nen&#237; vyps&#225;n po&#382;adovan&#253; po&#269;et prvo&#269;&#237;sel"/>
                        <if expression="n &lt; pocetcisel">
                            <then>
                                <comment text="P&#345;ipoj za &#269;&#237;slo na formul&#225;&#345;i &#269;&#225;rku"/>
                                <assign variable="vystup" expression="vystup &amp; &quot;, &quot;"/>
                            </then>
                            <else/>
                        </if>
                    </then>
                    <else/>
                </if>
                <comment text="Nov&#233; testovan&#233; &#269;&#237;slo, kter&#233; je o 1 vy&#353;&#353;&#237; ne&#382; p&#345;edchoz&#237;"/>
                <assign variable="i" expression="i + 1"/>
            </while>
            <comment text="V&#253;pis po&#382;adovan&#233;ho po&#269;tu prvo&#269;&#237;sel"/>
            <output expression="&quot;Prvo&#269;&#237;sla: &quot; &amp; vystup" newline="True"/>
        </body>
    </function>
    <function name="Prvocislo" type="Boolean" variable="b">
        <parameters>
            <parameter name="n" type="Integer" array="False"/>
        </parameters>
        <body>
            <comment text="Deklarace: 'b' ... informace, zda je testovan&#233; (p&#345;edan&#233;) &#269;&#237;slo prvo&#269;&#237;slem (true - je prvo&#269;&#237;slem); 'i' ... d&#283;litel (&#269;&#237;ta&#269;)"/>
            <declare name="b" type="Boolean" array="False" size=""/>
            <declare name="i" type="Integer" array="False" size=""/>
            <comment text="Inicializace"/>
            <assign variable="b" expression="true"/>
            <assign variable="i" expression="2"/>
            <comment text="Pokud je p&#345;edan&#233; &#269;&#237;slo rovn&#233; 1, pak..."/>
            <if expression="n == 1">
                <then>
                    <comment text="P&#345;edan&#233; &#269;&#237;slo 1 nen&#237; prvo&#269;&#237;slo"/>
                    <assign variable="b" expression="false"/>
                </then>
                <else/>
            </if>
            <comment text="Cyklus - dokud plat&#237;, &#382;e testovan&#233; &#269;&#237;slo je prvo&#269;&#237;slo a &#269;&#237;ta&#269; je men&#353;&#237; ne&#382; testovan&#233; &#269;&#237;slo"/>
            <while expression="(b == true) &amp;&amp; (i &lt; n)">
                <comment text="Pokud testovan&#233; &#269;&#237;slo je d&#283;liteln&#233; beze zbytku"/>
                <if expression="n % i == 0">
                    <then>
                        <comment text="Testovan&#233; &#269;&#237;slo nen&#237; prvo&#269;&#237;slo"/>
                        <assign variable="b" expression="false"/>
                    </then>
                    <else/>
                </if>
                <comment text="Inkrementace"/>
                <assign variable="i" expression="i + 1"/>
            </while>
            <comment text="V&#253;stupem metody je informace, kter&#225; je ulo&#382;ena v logick&#233; prom&#283;nn&#233;"/>
        </body>
    </function>
</flowgorithm>
