commit c5be086b9f3936f50d578998e231cb7dda413b37
parent 0015bf03cb696463506ccc506d50f101de8cf133
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Tue, 17 Mar 2026 18:08:51 +0530
[2026-03-17] : .\Semester_1\assignment-primary : added assignment 14, 15
Diffstat:
7 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/Semester_1/assignment-primary/Assignment.docx b/Semester_1/assignment-primary/Assignment.docx
Binary files differ.
diff --git a/Semester_1/assignment-primary/Assignment.pdf b/Semester_1/assignment-primary/Assignment.pdf
Binary files differ.
diff --git a/Semester_1/assignment-primary/EVENFile.txt b/Semester_1/assignment-primary/EVENFile.txt
@@ -0,0 +1 @@
+12 16 2 6 2 164 64 +
\ No newline at end of file
diff --git a/Semester_1/assignment-primary/ODDFile.txt b/Semester_1/assignment-primary/ODDFile.txt
@@ -0,0 +1 @@
+15 21 25 1 5 +
\ No newline at end of file
diff --git a/Semester_1/assignment-primary/assignment-p-15.c b/Semester_1/assignment-primary/assignment-p-15.c
@@ -11,8 +11,6 @@ numbers in a new file named 'ODDFile.txt' while storing the even numbers in anot
named 'EVENFile.txt' */
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#define FILENAME "input.txt"
#define ODDFILE "ODDFile.txt"
@@ -24,24 +22,28 @@ int main()
FILE *oddfile = NULL;
FILE *evenfile = NULL;
int num;
+
input = fopen(FILENAME, "r");
if (input == NULL)
{
printf("\nCould not open the file: %s", FILENAME);
return 1;
}
+
oddfile = fopen(ODDFILE, "w");
if (oddfile == NULL)
{
printf("\nCould not open the file: %s", ODDFILE);
return 1;
}
+
evenfile = fopen(EVENFILE, "w");
if (evenfile == NULL)
{
printf("\nCould not open the file: %s", EVENFILE);
return 1;
}
+
while (fscanf(input, "%d", &num) == 1)
{
if (num % 2 == 0)
@@ -53,7 +55,8 @@ int main()
fprintf(oddfile, "%d ", num);
}
}
- printf("\nSuccessfully processed numbers from %s.\n", FILENAME);
+
+ printf("Successfully processed numbers from %s.\n", FILENAME);
printf("Odd numbers written to %s.\n", ODDFILE);
printf("Even numbers written to %s.\n", EVENFILE);
diff --git a/Semester_1/assignment-primary/input.txt b/Semester_1/assignment-primary/input.txt
@@ -0,0 +1 @@
+12 15 16 21 25 1 5 2 6 2 164 64+
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
@@ -822,6 +822,38 @@ bool isPalindrome(char str[]) {
<div class="hidden pl-4 mt-1 border-l-2 border-slate-100 ml-3.5">
<div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-assignment-primary-EVENFile-txt', 'EVENFile.txt', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/EVENFile.txt')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">EVENFile.txt</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/EVENFile.txt" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-Semester_1-assignment-primary-EVENFile-txt" style="display:none;">12 16 2 6 2 164 64 </div>
+ </div>
+
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-assignment-primary-ODDFile-txt', 'ODDFile.txt', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/ODDFile.txt')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">ODDFile.txt</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/ODDFile.txt" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-Semester_1-assignment-primary-ODDFile-txt" style="display:none;">15 21 25 1 5 </div>
+ </div>
+
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
<div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-assignment-primary-assignment-p-01-c', 'assignment-p-01.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/assignment-p-01.c')">
<svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
@@ -1987,8 +2019,6 @@ numbers in a new file named 'ODDFile.txt' while storing the even numbe
named 'EVENFile.txt' */
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#define FILENAME "input.txt"
#define ODDFILE "ODDFile.txt"
@@ -2000,24 +2030,28 @@ int main()
FILE *oddfile = NULL;
FILE *evenfile = NULL;
int num;
+
input = fopen(FILENAME, "r");
if (input == NULL)
{
printf("\nCould not open the file: %s", FILENAME);
return 1;
}
+
oddfile = fopen(ODDFILE, "w");
if (oddfile == NULL)
{
printf("\nCould not open the file: %s", ODDFILE);
return 1;
}
+
evenfile = fopen(EVENFILE, "w");
if (evenfile == NULL)
{
printf("\nCould not open the file: %s", EVENFILE);
return 1;
}
+
while (fscanf(input, "%d", &num) == 1)
{
if (num % 2 == 0)
@@ -2029,7 +2063,8 @@ int main()
fprintf(oddfile, "%d ", num);
}
}
- printf("\nSuccessfully processed numbers from %s.\n", FILENAME);
+
+ printf("Successfully processed numbers from %s.\n", FILENAME);
printf("Odd numbers written to %s.\n", ODDFILE);
printf("Even numbers written to %s.\n", EVENFILE);
@@ -2041,6 +2076,22 @@ int main()
}</div>
</div>
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-assignment-primary-input-txt', 'input.txt', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/input.txt')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">input.txt</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/assignment-primary/input.txt" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-Semester_1-assignment-primary-input-txt" style="display:none;">12 15 16 21 25 1 5 2 6 2 164 64</div>
+ </div>
+
</div>
</div>