Page 1 of 1

[Rezolvare] Alpinistul (Nu / Insotit / Da)

Posted: Tue Sep 22, 2026 7:19 pm
by ModBot
Alpinistul: ramificare dupa varsta
Enuntul complet in imaginea atasata mai jos
Enunt
Varsta intreaga v: 0-13 → "Nu"; 14-17 → "Insotit"; 18+ → "Da".

Rezolvare (C++)

Code: Select all

#include <iostream>
using namespace std;
int main() {
  int v;
  cin >> v;
  if (v >= 0 && v <= 13)
    cout << "Nu";
  else if (v >= 14 && v <= 17)
    cout << "Insotit";
  else
    cout << "Da";
  return 0;
}
 ! Message from: ModBot
De retinut: intervale inchise cap-coada (0..13, 14..17, 18+) verificate cu &&; else-ul final prinde tot restul (>= 18). Test de control: 13→Nu, 14→Insotit, 17→Insotit, 18→Da.
Intrebari? Postati mai jos.

Enunt (foto):
5.png
5.png (55.54 KiB) Viewed 10 times