Few words to jot down

The key to life is accepting challenges 
 
Obstacles can't stop you.

Problems can't stop you.

Most of all other people can't stop you.

Only you can stop yourself.

Challenges are what make life interesting;
Overcoming them is what makes life meaningful.

Boring C code ever! - Easy to get error

Khi sử dụng một #define trong C, chúng ta nên chú ý dùng dấu ngoặc trong các biểu thức được define.
Ngoài ra, nếu trước đó ta đã khai báo một biến, sau đó lại define một tên trùng với tên biến đó. Thì từ lúc define đó trở đi, tên được define sẽ được sử dụng cho tới khi ta undef nó ( như ví dụ với M bên dưới)

#include

#define in printf
#define N 100
#define length1 3 + 5
#define length2 (3+5)
void main()
{
    int M = 200;
    int x = 2*length1;
    int y = 2*length2;
    in("\n N= %d M=%d",N,M);
#define M 300
    in("\nM=%d",M);
#undef M
    in("\nM=%d",M);
    in("\n%d",x);
    in("\n%d",y);
}

[Thuật toán cơ bản] Xác định số nguyên tố

Xác định số nguyên tố: ngôn ngữ C

#include
#include

void main()
{
int i,n,ngt=1;
printf("Nhap so n = "); scanf("%d",n);
for(i=0;i
(ng_to=1)?printf("%d la so nguyen to",i):printf("%d khong la hop so",i);
getch();
}

Lập trình C: Tìm số nguyên tố
Tìm số nguyên tố dùng C
Thuật toán tìm số nguyên tố dùng C
Thuật toán xác định số nguyên tố dùng C
Related Posts Plugin for WordPress, Blogger...