This commit is contained in:
2024-03-05 14:19:35 +03:00
parent b199446865
commit a4b587dc41
31 changed files with 0 additions and 0 deletions

BIN
w3school/a.exe Normal file

Binary file not shown.

21
w3school/arrayfunc.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
void myFunc(int myNum[5]) {
for (int i = 0; i < 5; i++) {
printf("%d\n", myNum[i]);
}
{
int i = 0;
while (i < 5) {
printf("%d\n", myNum[i]);
i++;
}
}
}
int main() {
int myNum[5] = {25, 50, 75, 100, 125};
myFunc(myNum);
return 0;
}

12
w3school/arrays.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
int main() {
int myNumbers[] = {11, 22, 33, 44, 55};
printf("%d\n", myNumbers[4]);
int matrix[2][3] = { {1, 4, 9}, {2, 5, 7} };
printf ("%d\n", matrix[1][2]);
printf ("%p", &myNumbers);
return 0;
}

14
w3school/booleans.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdbool.h>
#include <stdio.h>
int main() {
int votingAge = 18;
int myAge = 18;
if (myAge > votingAge) {
printf("Oy verebilirsiniz!");
} else if (myAge == votingAge) {
printf("test2");
} else {
printf("test1");
}
}

11
w3school/charfunc.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
void myFunc(char name[], int age) {
printf("Hello %s. You're %d years old\n", name, age);
}
int main() {
myFunc("Liam", 3);
myFunc("Ahmet", 30);
return 0;
}

13
w3school/declarition.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
int myFunc(int,int);
int main(){
int result = myFunc(5, 3);
printf("Result is %d", result);
return 0;
}
int myFunc(int x, int y){
return x + y;
}

14
w3school/fgets.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
int main() {
int test1;
char test2[50];
char test3[50];
printf("Test box! : ");
fgets(test2, sizeof(test2), stdin);
printf("WORKING! : %s", test2);
printf("TEST2! : ");
fgets(test3, sizeof(test3), stdin);
printf("WORKING2!: %s", test3);
return 0;
}

12
w3school/file.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
int main() {
FILE *fptr;
fptr = fopen("test1.txt", "a");
fprintf(fptr, "\nThis is Working!");
fclose(fptr);
return 0;
}

16
w3school/fileopen.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
int main () {
FILE *fptr;
fptr = fopen("test1.txt", "r");
char myStr[100];
while(fgets(myStr, 100, fptr)) {
printf("%s", myStr);
}
fclose (fptr);
return 0;
}

15
w3school/for loop.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 2; ++i) {
printf("test: %d\n", i);
for (j = 1; j <= 3; ++j) {
printf("test2 : %d\n", j);
}
}
return 0;
}

11
w3school/function.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
void myFunc() {
printf("My first Function!");
}
int main() {
myFunc();
return 0;
}

12
w3school/function2.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
int myProg(int x) {
return x + 3;
}
int main() {
int y = 5;
printf("%d\n", myProg(y));
return 0;
}

27
w3school/hello.c Normal file
View File

@ -0,0 +1,27 @@
#include <stdio.h>
int main() {
// Learning C types
int myNum;
char myChar;
float myFloat;
myChar = 'a';
myFloat = 1.55;
int myNumero = 11;
myNum = myNumero;
int x = 4;
int y = 10;
int suma = x + y;
int a = 10, b = 20, c = 30;
float sum = (float) y / x;
int myInt = 9.99;
//printf("My fav number is :%d\n", myNum);
printf("%lu\n", sizeof(myFloat));
printf("%lu\n", sizeof(myChar));
//printf("My fav number is: %d\t and My fav character is: %c\n", myNum, myChar);
printf("%lu\n", sizeof(suma));
//printf("%d\n", a + b +c);
//printf("%.1f\n", sum);
printf("%lu\n", sizeof(myInt));
return 0;
}

14
w3school/input.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
int main() {
int sakiriNum;
char sakireDeger[30];
printf("Please, enter a number: \n");
scanf("%d", &sakiriNum);
printf("Please, enter your name: \n");
scanf("%s", sakireDeger);
printf("You pressed sakir: %d,", sakiriNum);
printf(" %s!", sakireDeger);
return 0;
}

11
w3school/loop.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
int main() {
int i = 0;
while (i >= 5) {
printf("%d\n", i);
i++;
}
}

16
w3school/math.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <math.h>
int myProg(int, int);
int main(){
float fullNum;
int b;
printf("Lutfen rakam giriniz! \n");
scanf("%f\n", &fullNum);
printf("%f\n", ceil(fullNum));
printf("%f", floor(fullNum));
return 0;
}

13
w3school/matrix.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
int main() {
int matrix[2][3] = { {1, 2, 3}, {4, 5, 6} };
int i,j;
for (i = 0; i < 2; i++) {
for (j = 0; j < 3; j++) {
printf ("%d\n", matrix[i][j]);
}
}
return 0;
}

14
w3school/pointer.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
int main () {
int speedTrain = 150;
int* ptr = &speedTrain;
printf("%d\n", speedTrain);
printf("%p\n", &speedTrain);
printf("%p\n", ptr);
printf("%d\n", *ptr);
return 0;
}

16
w3school/pointerarrays.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
int main() {
int myNum[4] = {25, 50, 75, 100};
int i;
int j;
for (i = 0; i < 4; i++) {
printf("%p\n", &myNum[i]);
}
printf("%lu\n", sizeof(j));
printf("%p\n", myNum);
printf("%p\n", &myNum[0]);
printf("%lu\n", sizeof(myNum));
return 0;
}

15
w3school/pointerarrays2.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main() {
int myNumbers[4] = {25, 50, 75, 100};
int *ptr = myNumbers;
int i;
*myNumbers = 101;
*(myNumbers + 1) = 55;
for (i = 0; i < 4; i++) {
printf("%d\n", *(ptr + i));
}
printf("%d\n", *(myNumbers + 1));
return 0;
}

22
w3school/recursion.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
int myProg(int k);
int main() {
int b;
printf("Type a num: \n");
scanf("%d", &b);
int result = myProg(b);
printf("%d\n", result);
return 0;
}
int myProg(int k) {
if (k > 10) {
return k + myProg(k - 1);
} else {
return 0;
}
}

View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main () {
char txt[] = "If i live in a \"different\" universe i love you";
printf ("%s", txt);
return 0;
}

10
w3school/string.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <string.h>
int main () {
char test[40] = "TESTING";
char test2[50] = " WORKING";
char test3[50] = "TESTING";
printf("%d", strcmp(test, test3));
return 0;
}

8
w3school/strings.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main () {
char greetings[] = "Hello!";
greetings[0] = 'Y';
printf("%s\n", greetings);
return 0;
}

17
w3school/stringsloop.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
int main () {
char carName[] = "GOLF";
int i;
int j = 0;
while (j < 5) {
for (i = 0; i < 5; i++) {
printf ("%c\t", carName[i]);
}
printf ("\n");
j++;
}
return 0;
}

28
w3school/structer.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <string.h>
struct myStruct {
int myNum;
char myLtr;
char myString[30];
};
int main () {
struct myStruct s1;
s1.myNum = 10;
s1.myLtr = 'a';
strcpy(s1.myString, "Greetings!");
struct myStruct s2;
s2.myNum = 19;
s2.myLtr = 'C';
printf("%s\n", s1.myString);
printf("%d\n", s1.myNum);
printf("%c\n", s1.myLtr);
printf("%d\n", s2.myNum);
printf("%c\n", s2.myLtr);
return 0;
}

17
w3school/structer2.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
#include <string.h>
struct myStruct {
int myNum;
char myNam[30];
};
int main () {
struct myStruct s3 = {15, "Hello World!"};
printf("%d\n%s", s3.myNum, s3.myNam);
return 0;
}

42
w3school/switch.c Normal file
View File

@ -0,0 +1,42 @@
#include <stdio.h>
int main() {
int day = 8;
switch (day) {
case 1:
printf("monday");
break;
case 2:
printf("tuesday");
break;
case 3:
printf("wednesday");
break;
case 4:
printf("thursday");
break;
case 5:
printf("friday");
break;
case 6:
printf("saturday");
break;
case 7:
printf("sunday");
break;
default:
printf("there's 7 day in week!");
}
}

2
w3school/test1.txt Normal file
View File

@ -0,0 +1,2 @@
Hello World!
This is Working!

7
w3school/test2.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
int x = 7;
int y = 5;
printf ("%d\n", !(x > 4 && y > 4));
}