From 7c6fcb78b36e6a86d17223eb4c0cd19866e8f80a Mon Sep 17 00:00:00 2001 From: Hello_User Date: Mon, 16 Sep 2019 15:11:30 +0200 Subject: [PATCH] Small Updates --- .vscode/tasks.json | 49 ++++++++++++++++++++++++++++++++++++++++++++++ Assignment 4/2.c | 35 --------------------------------- 2 files changed, 49 insertions(+), 35 deletions(-) create mode 100644 .vscode/tasks.json delete mode 100644 Assignment 4/2.c diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..2272338 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,49 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "label": "gcc.exe build active file", + "command": "C:\\MinGW\\bin\\gcc.exe", + "args": [ + "-g", + "-ansi", + "-pedantic", + "-Wall", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "C:\\MinGW\\bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build" + }, + { + "type": "shell", + "label": "gcc.exe build active file", + "command": "C:\\MinGW\\bin\\gcc.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "C:\\MinGW\\bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/Assignment 4/2.c b/Assignment 4/2.c deleted file mode 100644 index 673f1a8..0000000 --- a/Assignment 4/2.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include - -int is_prime(int number) -{ /*Function decleration and definition */ - int x, temp = 0; - printf("%d is being checked\n",number); - for (x = 2; pow(x, 2) >= number; x++) { /*using for loop to determine if input is not prime*/ - printf("%d \t am in loop\n",number); - if (number < 2) { /*If number is 0 or 1, it is not prime*/ - temp = 1; - printf("%d is below 2, is not prime\n",number); - } - if (number % x == 0) { /*If remainder of input/x^2 = 0 then the number is not prime*/ - temp = 1; - printf("%d has another divisor, is not prime\n",number); - break; - } - } - if (temp == 0) { /*Print out number if the value of temp is not equal to 1 (so it outputs only prime number)*/ - printf("%d\n", number); - } - return number; -} - -int main() -{ - int lower_limit, upper_limit, i; /*Declaring variables*/ - scanf("%d%d", &lower_limit, &upper_limit); /*Storing user input in lower and upper limit variables*/ - for (i = lower_limit; i <= upper_limit; i++) { /*using for loop to call is_prime function to calculate if the number is prime*/ - is_prime(i); - } - return 0; -} \ No newline at end of file