Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main() {
- ifstream fin("date.in");
- ofstream fout("date.out");
- unsigned int n;
- fin >> n;
- unsigned int x = 1;
- // trebuie sa afisez n+1 linii
- for(int rep = 0; rep <= n; ++rep) {
- // afisez spatiile de la inceputul liniiei
- for(int i = 0; i < n-rep; ++i) {
- fout << " ";
- }
- // trebuie sa afisez cate 1, 3, 5 ... 2*n+1 numere pe fiecare linie
- // in ordine crescatoare
- for(int i = 0; i < 2*rep+1; ++i) {
- fout << x++ << " ";
- }
- fout << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement