move exercises and lectures into subfolders

This commit is contained in:
2023-10-15 15:34:53 +01:00
parent 775b4bd643
commit 74092a17aa
177 changed files with 0 additions and 0 deletions

28
Exercises/C6/ex1.c Normal file
View File

@@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare some variables
int a, b;
// Note: Order of a,b indicates the order in which operations are carried out on execution
// Increment operators
b = 3;
printf("a=%d b=%d\n", a, b);
a = ++b; // b is now 4, a is also 4
printf("a=%d b=%d\n", a, b);
a = b++; // a is 4, b is now 5,
printf("a=%d b=%d\n", a, b);
// Decrement operators (reset a back to 3)
b = 3;
printf("a=%d b=%d\n", a, b);
a = b--; // a is 3, b is now 2
printf("a=%d b=%d\n", a, b);
a = --b; // b is now 1, a is also 1
printf("a=%d b=%d\n", a, b);
return 0; // Exit from main
}

14
Exercises/C6/ex2.c Normal file
View File

@@ -0,0 +1,14 @@
#include <stdio.h>
int main() {
unsigned int a = 60;
unsigned int b = 13;
unsigned int r;
r = a & b;
printf("bitwise AND of 60 and 13: %d\n", r);
r = a | b;
printf("bitwise OR of 60 and 13: %d\n", r);
r = a ^ b;
printf("bitwise XOR of 60 and 13: %d\n", r);
}

14
Exercises/C6/ex3.c Normal file
View File

@@ -0,0 +1,14 @@
#include <stdio.h>
int main() {
unsigned int a = 0x60;
unsigned int b = 0x13;
unsigned int r;
r = a & b;
printf("bitwise AND of 0x60 and 0x13: 0x%02x\n", r);
r = a | b;
printf("bitwise OR of 0x60 and 0x13: 0x%02x\n", r);
r = a ^ b;
printf("bitwise XOR of 0x60 and 0x13: 0x%02x\n", r);
}

View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare some variables
int a, b;
// Note: Order of a,b indicates the order in which operations are carried out on execution
// Increment operators
b = 3;
a = ++b; // b is now 4, a is also 4
a = b++; // a is 4, b is now 5,
// Decrement operators (reset a back to 3)
b = 3;
a = b--; // a is 3, b is now 2
a = --b; // b is now 1, a is also 1
return 0; // Exit from main
}