Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*
- 1. Adunati 2 numere.
- 2. Verificati daca numarul x este par (alegi tu x-ul).
- 3. Atata timp cat numerele dintr-un sir sunt pare (de la 1 la 20), afisati pe ecran PULENTIU. (NU TOATE TREBUIE SA FIE PARE)
- 4. Afisati dublul numerelor naturale dintr-un sir (de la 1 la 20)
- */
- int a, b, suma = 0 ;
- int x;
- int main()
- {
- cout << "PROBLEMA 1." << endl;
- cin >> a >> b;
- suma = a + b;
- cout << "PROBLEMA 1: " << "suma = " << suma << endl << endl;
- cout << "PROBLEMA 2." << endl;
- cin >> x;
- if(x % 2 == 0)
- cout << "PROBLEMA 2: " << x << " este PAR!" << endl << endl;
- else
- cout << "PROBLEMA 2: " << x << " NU este par..." << endl << endl;
- cout << "PROBLEMA 3." << endl;
- for(int i = 1; i <= 20; i++)
- if(i % 2 == 0)
- cout << "PULENTIU" << endl;
- cout << endl << endl;
- cout << "PROBLEMA 4." << endl;
- int j = 1;
- while(j <= 20)
- {
- cout << j * 2 << " ";
- j++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment