Câu 1: *Code: #include <stdio.h> #include <math.h> int is_valid_triangle(double a, double b, double c) { if (a <= 0 || b <= 0 || c <= 0) { return 0; } if (a + b < c || a + c < b || b + c < a) { return 0; } return 1; } double calculate_triangle_area(double a, double b, double c) { if (!is_valid_triangle(a, b, c)) { return 0; } double semi_perimeter = (a + b + c) / 2; double area = sqrt(semi_perimeter * (semi_perimeter - a) * (semi_perimeter - b) * (semi_perimeter c)); return area; } int main() { double a, b, c; printf("Enter the first side of the triangle: "); scanf("%lf", &a); printf("Enter the second side of the triangle: "); scanf("%lf", &b); printf("Enter the third side of the triangle: "); scanf("%lf", &c); if (!is_valid_triangle(a, b, c)) { printf("The sides are not valid triangle sides.\n"); return 1; } double area = calculate_triangle_area(a, b, c); printf("The area of the triangle is: %.2f\n", area); return 0; } *Terminal: (Test case đúng) tin@tin:~$ gcc lab03.c -o lab03.o -lm tin@tin:~$ ./lab03.o SE1803_CE180025_BuiVoTrungTin Enter the first side of the triangle: 3 Enter the second side of the triangle: 4 Enter the third side of the triangle: 5 The area of the triangle is: 6.00 (Test case sai) tin@tin:~$ gcc lab03.c -o lab03.o -lm tin@tin:~$ ./lab03.o SE1803_CE180025_BuiVoTrungTin Enter the first side of the triangle: 1 Enter the second side of the triangle: 2 Enter the third side of the triangle: 7 The sides are not valid triangle sides. Câu 2: *Code: #include <stdio.h> #include <string.h> int main() { printf("SE1803_CE180025_BuiVoTrungTin\n"); char s[501]; int n, i; printf("Nhap chuoi sau: "); scanf("%[^\n]", s); n=strlen(s); printf("Chuoi co: %d ky tu\n", n); printf("Chuoi da chuan hoa: "); for (i=0; i<n; ++i) { printf("%c", s[n - i - 1]); } printf("\n"); return 0; } *Terminal: tin@tin:~$ gcc lab03_2.c -o lab03_2.o -lm tin@tin:~$ ./lab03_2.o SE1803_CE180025_BuiVoTrungTin Nhap chuoi sau: truongdaihocfpt Chuoi co: 15 ky tu Chuoi da chuan hoa: tpfcohiadgnourt