Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Homework1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>

int main(void){
int a = 6;
int b = 8;
int c = 10;
if (c<a+b){
printf("This is a triangle\n");
}else if (c=a+b){
printf("This isn't a triangle\n");
}else if (c>a+b){
printf("This isn't a triangle\n");
}

return 0;
}
14 changes: 14 additions & 0 deletions Homework2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>
#include <stdlib.h>

int main(void){
int arr[4] = { 5, 7, 1, 6 };
int len = 0;
while(arr[len] != '\0'){
len++;
}

printf("The length of the array is %d\n", len);

return 0;
}
14 changes: 14 additions & 0 deletions Homework3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>
#include <stdlib.h>

int main(void){
int arr[6] = { 0, 3, 5, 2, 4, 10 };
// Find the element 4
for (int i = 0; i < 8; i++){
if(arr[i] == 4){
printf("Ans found: %d", arr[i]);
}
}

return 0;
}
Binary file added homework1.exe
Binary file not shown.
Binary file added homework2.exe
Binary file not shown.
Binary file added homework3.exe
Binary file not shown.