This commit is contained in:
2025-05-23 03:26:13 +03:00
parent 191705c1dc
commit 4e9b002e99
14 changed files with 307 additions and 0 deletions

38
DeitelC/Chapter6/sets.c Normal file
View File

@ -0,0 +1,38 @@
#include <stdio.h>
#define SIZE 11
int main (void) {
int sets1[SIZE] = {0};
int sets2[SIZE] = {0};
for(size_t i = 0; i < SIZE; i++) {
sets1[i] = i * 3;
sets2[i] = i * 5;
}
puts("Union of sets:");
for(size_t i = 0; i < SIZE; i++) {
for(size_t j = 0; j < SIZE; j++) {
if(sets1[i] == sets2[j]) {
printf("%d\t", sets1[i]);
}
}
}
puts("Intersection of sets:");
for(size_t i = 0; i < SIZE; i++) {
for(size_t j = 0; j < SIZE; j++) {
if(sets1[i] != sets2[j]) {
printf("%d\t", sets1[i]);
printf("%d\t", sets2[j]);
}
}
}
return 0;
}