C, pasted on Sep 12:
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 ``` ```#include #include int main() { int i, j, n; printf("\nNhap n: "); scanf("%d", &n); // Câu a: for(i = 1; i <= n; ++i) { for(j = 1; j <= n + i - 1; ++j) { printf((j < n - i + 1) ? " " : "%c", 234); } putchar('\n'); } // Câu b: for(i = 1; i <= n; ++i) { for(j = 1; j <= n + i - 1; ++j) { printf((j == n - i + 1 || j == n + i - 1 || i == n) ? "%c" : " ", 234); } putchar('\n'); } printf("\n"); // Câu c: for(i = 1; i <= n; ++i) { for(j = 1; j <= n; ++j) { printf((j <= i) ? "%c" : " ", 234); } printf("\n\n"); } // Câu d for(i = 1; i <= n; ++i) { for(j = 1; j <= n; ++j) { printf((j == i || j == 1 || i == n) ? "*" : " "); } printf("\n"); } getch(); return 0; } //#include //#include //int main() //{ // for (int i = 0; i < 255; i++) // { // printf("ASCII value of character %c: %d\n", i, i); // } // getch(); // return 0; //} ```

Output:
 ```1 ``` ```Line 17: error: conio.h: No such file or directory ```

#include <iostream>
#include <math.h>
using namespace std;

void triangle(int n)
{
// number of spaces
int k = 2 * n - 2;

// Outer loop to handle number of rows
// n in this case
for (int i = 0; i < n; i++) {

// Inner loop to handle number spaces
// values changing acc. to requirement
for (int j = 0; j < k; j++)
cout << " ";

// Decrementing k after each loop
k = k - 1;

// Inner loop to handle number of columns
// values changing acc. to outer loop
for (int j = 0; j <= i; j++) {
// Printing stars
cout << "* ";
}

// Ending line after each row
cout << endl;
}
}

int main() {
int n;
printf("\nNhap n: ");
scanf("%d", &n);
triangle(n);
return 0;
}

#include <iostream>
#include <math.h>
using namespace std;

void triangle(int n)
{
for (int i = 1; i <= n; i++){
for (int k = n - i; k > 0; k--)
cout << " ";

for (int j = 1; j <= i; j++)
cout << "* ";
cout << endl;

}
}

int main() {
int n;
printf("\nNhap n: ");
scanf("%d", &n);
triangle(n);
return 0;
}