├── README.md ├── helloworld.c ├── plus.c ├── scanf_1.c ├── compute_height.c ├── compute_height_2.c └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | gist-c 2 | ====== 3 | -------------------------------------------------------------------------------- /helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | printf("hello world\n"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /plus.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int a, b; 5 | printf("Enter two number: "); 6 | scanf("%d %d", &a, &b); 7 | printf("%d + %d = %d\n", a, b, a + b); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /scanf_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int price = 0; 5 | const int AMOUNT = 100; 6 | printf("Enter price: "); 7 | scanf("%d", &price); 8 | printf("Change is: %d\n", AMOUNT - price); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /compute_height.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int foot, inch; 5 | printf("Enter foot and inch: "); 6 | scanf("%d %d", &foot, &inch); 7 | double result = (foot + inch / 12.0) * 0.3048; 8 | printf("Result height: %f\n", result); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /compute_height_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | double foot, inch; 5 | printf("Enter foot and inch: "); 6 | scanf("%lf %lf", &foot, &inch); 7 | double result = (foot + inch / 12) * 0.3048; 8 | printf("Result height: %f\n", result); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Libraries 8 | *.lib 9 | *.a 10 | 11 | # Shared objects (inc. Windows DLLs) 12 | *.dll 13 | *.so 14 | *.so.* 15 | *.dylib 16 | 17 | # Executables 18 | *.exe 19 | *.out 20 | *.app 21 | *.i*86 22 | *.x86_64 23 | *.hex 24 | 25 | *.swp 26 | *.swo 27 | 28 | /demo.c 29 | --------------------------------------------------------------------------------