<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3231_-_Afisare_Numere_2</id>
	<title>3231 - Afisare Numere 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=3231_-_Afisare_Numere_2"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3231_-_Afisare_Numere_2&amp;action=history"/>
	<updated>2026-05-01T06:49:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=3231_-_Afisare_Numere_2&amp;diff=520&amp;oldid=prev</id>
		<title>Bogdan.Pop: Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/3231/afisarenumere2 3231 - Afisare Numere 2] ---- == Cerinţa == Se dă un număr natural &#039;&#039;&#039;numar&#039;&#039;&#039;. Afișați pe o linie primele &#039;&#039;&#039;numar&#039;&#039;&#039; numere naturale nenule în ordine crescătoare, iar pe linia următoare aceleași numere, dar în ordine descrescătoare. == Date de intrare == Programul citește de la tastatură numărul &#039;&#039;&#039;numar&#039;&#039;&#039;. == Date de ieșire ==  Pe ecran se va afișa mesajul: &quot;Datele de intrare corespund restricțiil...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=3231_-_Afisare_Numere_2&amp;diff=520&amp;oldid=prev"/>
		<updated>2023-02-15T17:24:55Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/3231/afisarenumere2 3231 - Afisare Numere 2] ---- == Cerinţa == Se dă un număr natural &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039;. Afișați pe o linie primele &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; numere naturale nenule în ordine crescătoare, iar pe linia următoare aceleași numere, dar în ordine descrescătoare. == Date de intrare == Programul citește de la tastatură numărul &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039;. == Date de ieșire ==  Pe ecran se va afișa mesajul: &amp;quot;Datele de intrare corespund restricțiil...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sursa: [https://www.pbinfo.ro/probleme/3231/afisarenumere2 3231 - Afisare Numere 2]&lt;br /&gt;
----&lt;br /&gt;
== Cerinţa ==&lt;br /&gt;
Se dă un număr natural &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039;. Afișați pe o linie primele &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; numere naturale nenule în ordine crescătoare, iar pe linia următoare aceleași numere, dar în ordine descrescătoare.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură numărul &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
== Date de ieșire == &lt;br /&gt;
Pe ecran se va afișa mesajul: &amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot;, urmat, pe linii diferite de numere cerute. Numerele de pe aceeași linie sunt separate prin câte un spațiu. În cazul în care datele introduse de la tastatură nu îndeplinesc cerințele enunțate, programul va afișa &amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;.&lt;br /&gt;
== Restricţii şi precizări ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; &amp;amp;isin; &amp;amp;#8469;&lt;br /&gt;
* 1 &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; 100&lt;br /&gt;
== Exemplu ==&lt;br /&gt;
; Intrare&lt;br /&gt;
: 5&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele de intrare corespund restricțiilor impuse.&lt;br /&gt;
: 1 2 3 4 5&lt;br /&gt;
: 5 4 3 2 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
; Intrare&lt;br /&gt;
: abc&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele de intrare nu corespund restricțiilor impuse.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
; Intrare&lt;br /&gt;
: -25&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele de intrare nu corespund restricțiilor impuse.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Rezolvare == &lt;br /&gt;
=== Rezolvare ver. 1 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
# 3231 - Afisare Numere 2&lt;br /&gt;
&lt;br /&gt;
def validare_date_numar(numar: str) -&amp;gt; bool:&lt;br /&gt;
    try:&lt;br /&gt;
        int(numar)&lt;br /&gt;
        if 1 &amp;lt;= int(numar) &amp;lt;= 100:&lt;br /&gt;
            return True&lt;br /&gt;
        else:&lt;br /&gt;
            return False&lt;br /&gt;
    except ValueError:&lt;br /&gt;
        return False&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
def afisare_numere_1(numar: int):&lt;br /&gt;
    for nr in range(1, numar + 1):&lt;br /&gt;
        print(nr, end=&amp;quot; &amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
    print()&lt;br /&gt;
    &lt;br /&gt;
    for nr in reversed(range(1, numar + 1)):&lt;br /&gt;
        print(nr, end=&amp;quot; &amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    numar = input()&lt;br /&gt;
    &lt;br /&gt;
    if validare_date_numar(numar):&lt;br /&gt;
        numar = int(numar)&lt;br /&gt;
        &lt;br /&gt;
        print(&amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        afisare_numere_1(numar)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bogdan.Pop</name></author>
	</entry>
</feed>