bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit e026aa4255a5421f8b53c672c7825da8cdc4014d
parent d82b007e4d7eeaa9588708232948a7c42706170d
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Fri, 12 Dec 2025 11:10:43 +0530

[2025-12-12] .\docs\..\ : Updated code showing logic.

Diffstat:
Mdocs/generate_index.py | 56+++++++++++++++++++++++++-------------------------------
Mdocs/index.html | 17705++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mdocs/template.html | 253+++++++++++++++++++++++++++++++++----------------------------------------------
3 files changed, 17227 insertions(+), 787 deletions(-)

diff --git a/docs/generate_index.py b/docs/generate_index.py @@ -17,16 +17,6 @@ EXCLUDED_FILES = [ ] # --- End Configuration --- -def get_language_class(filename): - """Gets the highlight.js language class from the file extension.""" - if filename.endswith('.c'): return 'c' - if filename.endswith('.py'): return 'python' - if filename.endswith('.html'): return 'xml' - if filename.endswith('.js'): return 'javascript' - if filename.endswith('.css'): return 'css' - if filename.endswith('.md'): return 'markdown' - return 'plaintext' - def process_directory(current_path, relative_base=""): """ Recursively walks the directory and returns HTML string for the file tree. @@ -53,7 +43,7 @@ def process_directory(current_path, relative_base=""): if item not in EXCLUDED_FILES: files.append(item) - # Sort items (folders first, then files, alphabetically) + # Sort items dirs.sort() files.sort() @@ -62,15 +52,11 @@ def process_directory(current_path, relative_base=""): sub_path = os.path.join(current_path, d) rel_path = os.path.join(relative_base, d).replace("\\", "/") - # Recurse to get content content_html = process_directory(sub_path, rel_path) - # Only show folder if it has content (optional, but cleaner) if not content_html.strip(): continue - # Folder HTML Structure - # Note: onclick="toggleFolder(this)" passes the header element itself html_output += f""" <div class="folder-container mb-2"> <div class="flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-slate-100 rounded-lg transition-colors group select-none" onclick="toggleFolder(this)"> @@ -90,18 +76,29 @@ def process_directory(current_path, relative_base=""): # --- Generate HTML for Files --- for f in files: - # File URL for raw content fetching - raw_url = f"https://raw.githubusercontent.com/notamitgamer/bsc/main/{relative_base}/{f}".replace("//", "/") - # GitHub URL for viewing - github_url = f"{REPO_URL}/blob/main/{relative_base}/{f}".replace("//", "/") + full_file_path = os.path.join(current_path, f) + url_path = f"{relative_base}/{f}" if relative_base else f + github_url = f"{REPO_URL}/blob/main/{url_path}" - file_ext = os.path.splitext(f)[1] + # 1. READ CONTENT + try: + with open(full_file_path, 'r', encoding='utf-8', errors='ignore') as code_file: + raw_code = code_file.read() + except Exception as e: + raw_code = f"Error reading file content: {e}" + + # 2. ESCAPE CONTENT (Safe for HTML) + escaped_code = html.escape(raw_code) - # File Item HTML - # Using onclick to trigger modal + # 3. GENERATE UNIQUE ID + # Create a safe ID string from the path (e.g., "code-assignment-primary-file-c") + safe_id = "code-" + url_path.replace("/", "-").replace(".", "-").replace(" ", "-") + + # 4. GENERATE HTML + # We create a hidden DIV to store the code. html_output += f""" <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('{html.escape(f)}', '{html.escape(f)}', '{raw_url}')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('{safe_id}', '{html.escape(f)}', '{github_url}')"> <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> @@ -112,6 +109,8 @@ def process_directory(current_path, relative_base=""): <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="{safe_id}" style="display:none;">{escaped_code}</div> </div> """ @@ -119,13 +118,11 @@ def process_directory(current_path, relative_base=""): def main(): root_dir = os.getcwd() - - # Updated paths: Read template from and write index to the 'docs' folder docs_dir = os.path.join(root_dir, 'docs') template_path = os.path.join(docs_dir, 'template.html') output_path = os.path.join(docs_dir, 'index.html') - print("Generating index.html...") + print("Generating index.html with embedded code...") try: with open(template_path, 'r', encoding='utf-8') as f: @@ -140,9 +137,8 @@ def main(): # Inject into template final_html = template.replace('<!--FILE_LIST_PLACEHOLDER-->', file_list_html) - # 1. Write to local index.html in docs folder + # 1. Write to local index.html try: - # Ensure docs folder exists (just in case) os.makedirs(docs_dir, exist_ok=True) with open(output_path, 'w', encoding='utf-8') as f: f.write(final_html) @@ -150,12 +146,10 @@ def main(): except Exception as e: print(f"Error writing index.html: {e}") - # 2. Write to secondary path (Desktop) if accessible + # 2. Write to secondary path (Desktop) second_output_path = r"C:\Users\PC\Desktop\aranag.site\bsc.html" try: - # Create directory if it doesn't exist (safety check) os.makedirs(os.path.dirname(second_output_path), exist_ok=True) - with open(second_output_path, 'w', encoding='utf-8') as f: f.write(final_html) print(f"Also updated bsc.html successfully at '{second_output_path}'.") diff --git a/docs/index.html b/docs/index.html @@ -3,6 +3,8 @@ <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <!-- Fix favicon 404 error --> + <link rel="icon" href="data:,"> <title>notamitgamer/bsc Repository File Index</title> <script src="https://cdn.tailwindcss.com"></script> <link @@ -125,7 +127,7 @@ </p> </div> </div> - <!-- Mobile: Github Icon (Visible only on small screens to save space in row 2) --> + <!-- Mobile: Github Icon --> <a href="https://github.com/notamitgamer/bsc" target="_blank" class="sm:hidden text-slate-600 hover:text-slate-900"> <svg class="w-6 h-6" 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> @@ -172,16 +174,8 @@ class="hidden sm:flex bg-slate-900 hover:bg-slate-800 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all shadow-sm items-center gap-2" > <span>GitHub</span> - <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 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> @@ -207,213 +201,1539 @@ <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('assignment-p-01.c', 'assignment-p-01.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-01.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-01-c', 'assignment-p-01.c', 'https://github.com/notamitgamer/bsc/blob/main/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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-01.c</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/assignment-primary/assignment-p-01.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-01.c" 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-assignment-primary-assignment-p-01-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named isPrime with the signature +int isPrime(int num); The function should take an integer as a parameter and return 1 if +the number is prime and 0 otherwise. */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int isPrime(int); + +int main() +{ + int n; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + + if (isPrime(n)) + { + printf(&quot;\nInput %d is a Prime Number.&quot;, n); + } + else + { + printf(&quot;\nInput %d is not a Prime Number.&quot;, n); + } + + return 0; +} + +int isPrime(int n) +{ + if (n &lt;= 1) + return 0; + if (n == 2) + return 1; + if (n % 2 == 0) + return 0; + + int temp = (int)sqrt(n); + int i; + for (i = 3; i &lt;= temp; i += 2) + { + if (n % i == 0) + { + return 0; + } + } + return 1; +} +</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('assignment-p-02.c', 'assignment-p-02.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-02.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-02-c', 'assignment-p-02.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-02.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-02.c</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/assignment-primary/assignment-p-02.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-02.c" 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-assignment-primary-assignment-p-02-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named isArmstrong with the +signature int isArmstrong(int num);. An Armstrong number is a number that is equal to +the sum of its own digits each raised to the power of the number of digits. For example, +153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int isArmstrong(int); +int count(int); + +int main() +{ + int n; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + + if (isArmstrong(n)) + { + printf(&quot;\nInput %d is a Armstrong Number.&quot;, n); + } + else + { + printf(&quot;\nInput %d is Not a Armstrong Number.&quot;, n); + } + + return 0; +} + +int count(int n) +{ + int count = 0; + while (n &gt; 0) + { + count++; + n = n / 10; + } + return count; +} + +int isArmstrong(int n) +{ + if (n &lt; 0) + return 0; + if (n == 0) + return 1; + + int power = count(n); + int temp = n; + int checker = 0; + + while (temp &gt; 0) + { + int digit = temp % 10; + checker = checker + (int)round(pow(digit, power)); + temp = temp / 10; + } + return n == checker; +} +</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('assignment-p-03.c', 'assignment-p-03.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-03.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-03-c', 'assignment-p-03.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-03.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-03.c</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/assignment-primary/assignment-p-03.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-03.c" 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-assignment-primary-assignment-p-03-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named isPerfect with the signature +int isPerfect(int num);. A perfect number is a positive integer that is equal to the sum of +its proper divisors, excluding itself. For example, 28 is a perfect number because the sum +of its divisors (1, 2, 4, 7, 14) equals 28. */ + +#include &lt;stdio.h&gt; + +int isPerfect(int); + +int main() +{ + int n; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (isPerfect(n)) + { + printf(&quot;\nInput %d is a Perfect Number.&quot;, n); + } + else + { + printf(&quot;\nInput %d is not a Perfect Number.&quot;, n); + } + return 0; +} + +int isPerfect(int n) +{ + if (n &lt;= 1) + return 0; + int temp = 1; + int i; + for (i = 2; i &lt;= n / 2; i++) + { + if (n % i == 0) + { + temp += i; + } + } + return temp == n; +} +</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('assignment-p-04.c', 'assignment-p-04.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-04.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-04-c', 'assignment-p-04.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-04.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-04.c</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/assignment-primary/assignment-p-04.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-04.c" 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-assignment-primary-assignment-p-04-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that takes an integer input representing a month (1 to 12) and a year. +Use a switch statement to display the number of days in that month, considering leap years. */ + +#include &lt;stdio.h&gt; + +int main() +{ + int month, year, days; + printf(&quot;Enter the month (1 to 12) and year: &quot;); + scanf(&quot;%d %d&quot;, &amp;month, &amp;year); + + switch (month) + { + case 1: // jan + case 3: // mar + case 5: // may + case 7: // july + case 8: // aug + case 10: // oct + case 12: // dec + days = 31; + break; + case 4: // apr + case 6: // jun + case 9: // sep + case 11: // nov + days = 30; + break; + case 2: // feb + if ((year % 400 == 0) || ((year % 4 == 0) &amp;&amp; (year % 100 != 0))) + { + days = 29; + } + else + { + days = 28; + } + break; + default: + printf(&quot;\nYou entered something wrong.&quot;); + return 0; + } + + printf(&quot;\nNumber of days: %d&quot;, days); + return 0; +} +</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('assignment-p-05.c', 'assignment-p-05.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-05.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-05-c', 'assignment-p-05.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-05.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-05.c</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/assignment-primary/assignment-p-05.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-05.c" 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-assignment-primary-assignment-p-05-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that defines an array of integers, and includes a user-defined function +named reverseArray with the signature void reverseArray(int arr[], int size);. The function +should reverse the elements of the array. */ + +#include &lt;stdio.h&gt; + +void inputArray(int[], int); +void reverseArray(int[], int); + +int main() +{ + int size; + printf(&quot;How many element do you want to add: &quot;); + scanf(&quot;%d&quot;, &amp;size); + int arr[size]; + inputArray(arr, size); + reverseArray(arr, size); + return 0; +} + +void inputArray(int arr[], int size) +{ + int i; + for (i = 0; i &lt; size; i++) + { + printf(&quot;Enter element %d: &quot;, i + 1); + scanf(&quot;%d&quot;, &amp;arr[i]); + } +} + +void reverseArray(int arr[], int size) +{ + int i, j, temp; + printf(&quot;\nBefore Reverse: \n&quot;); + for (i = 0; i &lt; size; i++) + { + printf(&quot;Position: %d, Value: %d\n&quot;, i, arr[i]); + } + for (i = 0, j = size - 1; i &lt; j; i++, j--) + { + temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + printf(&quot;\nAfter Reverse: \n&quot;); + for (i = 0; i &lt; size; i++) + { + printf(&quot;Position: %d, Value: %d\n&quot;, i, arr[i]); + } +}</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('assignment-p-06.c', 'assignment-p-06.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-06.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-06-c', 'assignment-p-06.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-06.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-06.c</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/assignment-primary/assignment-p-06.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-06.c" 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-assignment-primary-assignment-p-06-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named findLargest with the +signature int findLargest(int arr[], int size);. The function should take an array of integers +and its size, and return the largest element in the array. */ + +#include &lt;stdio.h&gt; + +void inputArray(int[], int); +int findLargest(int[], int); + +int main() +{ + int size; + printf(&quot;How many element do you want to enter: &quot;); + scanf(&quot;%d&quot;, &amp;size); + int arr[size]; + inputArray(arr, size); + printf(&quot;\nLargest Element is: %d&quot;, findLargest(arr, size)); + return 0; +} + +void inputArray(int arr[], int size) +{ + int i; + for (i = 0; i &lt; size; i++) + { + printf(&quot;Enter element %d: &quot;, i + 1); + scanf(&quot;%d&quot;, &amp;arr[i]); + } +} + +int findLargest(int arr[], int size) +{ + int largest = arr[0], i; + for (i = 1; i &lt; size; i++) + { + if (largest &lt; arr[i]) + { + largest = arr[i]; + } + } + return largest; +}</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('assignment-p-07.c', 'assignment-p-07.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-07.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-07-c', 'assignment-p-07.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-07.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-07.c</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/assignment-primary/assignment-p-07.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-07.c" 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-assignment-primary-assignment-p-07-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named binarySearch with the +signature int binarySearch(int arr[], int size, int target);. The function should perform a +binary search on a sorted array of integers and return the index of the target element if +found, and -1 otherwise. */ + +#include &lt;stdio.h&gt; + +int inputArray(int[], int); +// void sortArray(int[], int); +int binarySearch(int[], int, int); + +int main() +{ + int size; + printf(&quot;How many element do you want to enter: &quot;); + scanf(&quot;%d&quot;, &amp;size); + int arr[size]; + int target = inputArray(arr, size); + // sortArray(arr, size); + int index = binarySearch(arr, size, target); + if (index != -1) + { + printf(&quot;\nElement %d is found at index %d.&quot;, target, index); + } + else + { + printf(&quot;\nElement %d is not found.&quot;, target); + } + return 0; +} + +int inputArray(int arr[], int size) +{ + int i, target; + for (i = 0; i &lt; size; i++) + { + printf(&quot;Enter element for position %d: &quot;, i); + scanf(&quot;%d&quot;, &amp;arr[i]); + } + printf(&quot;\nEnter the target element: &quot;); + scanf(&quot;%d&quot;, &amp;target); + return target; +} + +/* void sortArray(int arr[], int size) +{ + // using Bubble Sort... + + int tempArr[size], i, j, temp; + printf(&quot;\nBefore Sorting:\n[&quot;); + for (i = 0; i &lt; size; i++) + { + printf(&quot;%d&quot;, arr[i]); + if (i != size - 1) + { + printf(&quot;, &quot;); + } + } + printf(&quot;]\n&quot;); + for (i = 0; i &lt; size - 1; i++) + { + for (j = 0; j &lt; size - i - 1; j++) + { + if (arr[j] &gt; arr[j + 1]) + { + temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; + } + } + } + printf(&quot;\nAfter Sorting:\n[&quot;); + for (i = 0; i &lt; size; i++) + { + printf(&quot;%d&quot;, arr[i]); + if (i != size - 1) + { + printf(&quot;, &quot;); + } + } + printf(&quot;]\n&quot;); +} +*/ + +int binarySearch(int arr[], int size, int target) +{ + int low = 0; + int high = size - 1; + int mid; + while (low &lt;= high) + { + mid = low + ((high - low) / 2); + if (arr[mid] == target) + { + return mid; + } + else if (arr[mid] &gt; target) + { + high = mid - 1; + } + else if (arr[mid] &lt; target) + { + low = mid + 1; + } + } + return -1; +}</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('assignment-p-08.c', 'assignment-p-08.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-08.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-08-c', 'assignment-p-08.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-08.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-08.c</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/assignment-primary/assignment-p-08.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-08.c" 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-assignment-primary-assignment-p-08-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named countSetBits with the +signature int countSetBits(int num);. The function should count and return the number of +set bits (1s) in the binary representation of the given number. */ + +#include &lt;stdio.h&gt; + +int countSetBits(int); + +int main() +{ + int num, result; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;num); + if (result = countSetBits(num)) + { + printf(&quot;\nNumber of set bits in %d: %d&quot;, num, result); + } + else + { + printf(&quot;\nThere is no set bits in %d&quot;, num); + } + return 0; +} + +int countSetBits(int num) +{ + int count = 0; + if (num &lt; 0) + { + printf(&quot;\nOnly positive numbers are allowed to maintain consistency. \nUsing absolute value %d&quot;, -num); + num = -num; + } + while (num &gt; 0) + { + if (num &amp; 1) + { + count++; + } + num &gt;&gt;= 1; + /* + Another method to do the above bitwise calculation... + if(num % 2 == 1) { + count++; + } + num /= 2; + */ + } + return count; +}</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('assignment-p-09.c', 'assignment-p-09.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-09.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-09-c', 'assignment-p-09.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-09.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-09.c</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/assignment-primary/assignment-p-09.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-09.c" 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-assignment-primary-assignment-p-09-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that includes a user-defined function named setBit with the signature +int setBit(int num, int position);. The function should set the bit at the specified position +(0-indexed) to 1 and return the modified number. */ + +#include &lt;stdio.h&gt; + +int setBit(int, int); + +int main() +{ + int num, position; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;num); + printf(&quot;Enter the postion where you want to set the bit (0-indexed): &quot;); + scanf(&quot;%d&quot;, &amp;position); + printf(&quot;\nModified number= %d&quot;, setBit(num, position)); + return 0; +} + +int setBit(int num, int position) +{ + int mask = 1 &lt;&lt; position; + return num | mask; +}</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('assignment-p-10.c', 'assignment-p-10.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-10.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-10-c', 'assignment-p-10.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-10.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-10.c</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/assignment-primary/assignment-p-10.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-10.c" 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-assignment-primary-assignment-p-10-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that defines a structure Rectangle with attributes length and width. +Include a user-defined function named calculateArea with the signature float +calculateArea(struct Rectangle r);. The function should calculate and return the area of +the rectangle. */ + +#include &lt;stdio.h&gt; + +struct Rectangle +{ + float length; + float width; +}; + +float calculateArea(struct Rectangle); + +int main() +{ + struct Rectangle rectangle; + printf(&quot;Enter the length of the Rectangle: &quot;); + scanf(&quot;%f&quot;, &amp;rectangle.length); + printf(&quot;Enter the width of the Rectangle: &quot;); + scanf(&quot;%f&quot;, &amp;rectangle.width); + printf(&quot;\nArea of the Rectangle = %g&quot;, calculateArea(rectangle)); +} + +float calculateArea(struct Rectangle r) +{ + return r.length * r.width; +}</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('assignment-p-11.c', 'assignment-p-11.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-11.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-11-c', 'assignment-p-11.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-11.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-11.c</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/assignment-primary/assignment-p-11.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-11.c" 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-assignment-primary-assignment-p-11-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that defines a structure Student containing the attributes rollNumber, +name, and marks. Include a user-defined function named displayStudent with the +signature void displayStudent(struct Student s);. The function should display the details +of a student. */ + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; + +struct Student +{ + int rollNumber; + char name[50]; + int marks; +}; + +void inputStudent(struct Student *, int); +void displayStudent(struct Student); + +int main() +{ + struct Student studentDetails[10]; + int i, inputCount; + printf(&quot;How many student details you want to add (Max: 10): &quot;); + if (scanf(&quot;%d&quot;, &amp;inputCount) != 1 || inputCount &lt; 1 || inputCount &gt; 10) + { + printf(&quot;\nInvalid Input.&quot;); + return 1; + } + for (i = 0; i &lt; inputCount; i++) + { + inputStudent(&amp;studentDetails[i], i + 1); + } + printf(&quot;\n=== Student Details ===\n&quot;); + for (i = 0; i &lt; inputCount; i++) + { + displayStudent(studentDetails[i]); + } + return 0; +} + +void inputStudent(struct Student *std, int stdNum) +{ + printf(&quot;\n- Enter details of Student %d -&quot;, stdNum); + printf(&quot;\nEnter the Roll Number: &quot;); + scanf(&quot;%d&quot;, &amp;std-&gt;rollNumber); + while (getchar() != &#x27;\n&#x27;) + ; + printf(&quot;Enter the Name: &quot;); + fgets(std-&gt;name, sizeof(std-&gt;name), stdin); + printf(&quot;Enter the Marks: &quot;); + scanf(&quot;%d&quot;, &amp;std-&gt;marks); +} + +void displayStudent(struct Student std) +{ + printf(&quot;\n\nRoll Number: %d&quot;, std.rollNumber); + printf(&quot;\nName : %s&quot;, std.name); + printf(&quot;Marks : %d&quot;, std.marks); +}</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('assignment-p-12.c', 'assignment-p-12.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-12.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-12-c', 'assignment-p-12.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-12.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-12.c</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/assignment-primary/assignment-p-12.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-12.c" 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-assignment-primary-assignment-p-12-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that takes multiple integers as command-line arguments and finds the +maximum and minimum value among them. */ + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +int main(int argc, char *argv[]) +{ + int current_val, max_val, min_val, i; + char *endptr; + long first_arg_val; + if (argc &lt; 2) + { + printf(&quot;Usage: %s &lt;integer1&gt; &lt;integer2&gt; ...\n&quot;, argv[0]); + return 1; + } + first_arg_val = strtol(argv[1], &amp;endptr, 10); + if (*endptr != &#x27;\0&#x27; || argv[1] == endptr) + { + printf(&quot;Error: Argument &#x27;%s&#x27; is not a valid integer.\n&quot;, argv[1]); + return 1; + } + max_val = (int)first_arg_val; + min_val = (int)first_arg_val; + for (i = 2; i &lt; argc; i++) + { + long val = strtol(argv[i], &amp;endptr, 10); + if (*endptr != &#x27;\0&#x27; || argv[i] == endptr) + { + printf(&quot;Error: Argument &#x27;%s&#x27; is not a valid integer.\n&quot;, argv[i]); + return 1; + } + current_val = (int)val; + if (current_val &gt; max_val) + { + max_val = current_val; + } + if (current_val &lt; min_val) + { + min_val = current_val; + } + } + printf(&quot;The maximum value is: %d\n&quot;, max_val); + printf(&quot;The minimum value is: %d\n&quot;, min_val); + return 0; +}</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('assignment-p-13.c', 'assignment-p-13.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-13.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-13-c', 'assignment-p-13.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-13.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-13.c</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/assignment-primary/assignment-p-13.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-13.c" 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-assignment-primary-assignment-p-13-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that accepts a string as a command line argument and includes a user- +defined function named isPalindrome with the signature int isPalindrome(char str[]);. +The function should check if the given string is a palindrome and return 1 if it is, and 0 +otherwise. */ + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +int isPalindrome(char[]); + +int main(int argc, char *argv[]) +{ + if (argc != 2) + { + printf(&quot;\nUsage: %s &lt;string&gt;\n&quot;, argv[0]); + return 1; + } + if (isPalindrome(argv[1])) + { + printf(&quot;\nThe entered string \&quot;%s\&quot; is a Palindrome.\n&quot;, argv[1]); + } + else + { + printf(&quot;\nThe entered string \&quot;%s\&quot; is not Palindrome.\n&quot;, argv[1]); + } + return 0; +} + +int isPalindrome(char str[]) +{ + char *start = str; + char *end = str; + if (*end != &#x27;\0&#x27;) + { + while (*(end + 1) != &#x27;\0&#x27;) + { + end++; + } + } + else + { + return 1; + } + /* + Or we can use string.h instead of from line 33 to line 43 like this ... + + char *end; + int len = strlen(str); + if (len == 0) + { + return 1; + } + end = str + (len - 1); + + */ + while (start &lt; end) + { + if (*start != *end) + { + return 0; + } + start++; + end--; + } + return 1; +}</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('assignment-p-14.c', 'assignment-p-14.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-14.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-14-c', 'assignment-p-14.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-14.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-14.c</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/assignment-primary/assignment-p-14.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-14.c" 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-assignment-primary-assignment-p-14-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that opens its own source code file, reads its contents, and then prints +the contents to the console. */ + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; + +int main(int argc, char *argv[]) +{ + FILE *code; + int character, len_upto_dot; + char *FILENAME; + char *dot; + + FILENAME = strdup(argv[0]); + + if (FILENAME == NULL) + { + printf(&quot;\nMemory allocation failed.\n&quot;); + return 1; + } + + dot = strrchr(FILENAME, &#x27;.&#x27;); + + if (dot != NULL) + { + len_upto_dot = dot - FILENAME; + FILENAME[len_upto_dot] = &#x27;\0&#x27;; + } + + strcat(FILENAME, &quot;.c&quot;); + + code = fopen(FILENAME, &quot;r&quot;); + + if (code == NULL) + { + printf(&quot;\nCould not open the source file: %s&quot;, FILENAME); + printf(&quot;\nPlease ensure the source file is in the same directory as the executable.\n&quot;); + free(FILENAME); + return 1; + } + + printf(&quot;\nReading file: %s&quot;, FILENAME); + printf(&quot;\n========== %s ==========\n\n&quot;, FILENAME); + + while ((character = fgetc(code)) != EOF) + { + putchar(character); + } + + printf(&quot;\n\n========== End of %s ==========\n&quot;, FILENAME); + + fclose(code); + free(FILENAME); + + return 0; +}</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('assignment-p-15.c', 'assignment-p-15.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-primary/assignment-p-15.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-primary-assignment-p-15-c', 'assignment-p-15.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-15.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-p-15.c</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/assignment-primary/assignment-p-15.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-15.c" 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-assignment-primary-assignment-p-15-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that reads a sequence of integers from a file named &#x27;input.txt&#x27;. This +program should segregate the odd numbers from the even numbers and store the odd +numbers in a new file named &#x27;ODDFile.txt&#x27; while storing the even numbers in another file +named &#x27;EVENFile.txt&#x27; */ + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;string.h&gt; + +#define FILENAME &quot;input.txt&quot; +#define ODDFILE &quot;ODDFile.txt&quot; +#define EVENFILE &quot;EVENFile.txt&quot; + +int main() +{ + FILE *numbers = NULL; + FILE *oddfile = NULL; + FILE *evenfile = NULL; + int num; + numbers = fopen(FILENAME, &quot;r&quot;); + if (numbers == NULL) + { + printf(&quot;\nCould not open the file: %s&quot;, FILENAME); + free(numbers); + return 1; + } + oddfile = fopen(ODDFILE, &quot;w&quot;); + if (oddfile == NULL) + { + printf(&quot;\nCould not open the file: %s&quot;, ODDFILE); + free(oddfile); + return 1; + } + evenfile = fopen(EVENFILE, &quot;w&quot;); + if (evenfile == NULL) + { + printf(&quot;\nCould not open the file: %s&quot;, EVENFILE); + free(evenfile); + return 1; + } + while (fscanf(numbers, &quot;%d&quot;, &amp;num) == 1) + { + if (num % 2 == 0) + { + fprintf(evenfile, &quot;%d &quot;, num); + } + else + { + fprintf(oddfile, &quot;%d &quot;, num); + } + } + printf(&quot;\nSuccessfully processed numbers from %s.\n&quot;, FILENAME); + printf(&quot;Odd numbers written to %s.\n&quot;, ODDFILE); + printf(&quot;Even numbers written to %s.\n&quot;, EVENFILE); + + fclose(numbers); + fclose(oddfile); + fclose(evenfile); + + return 0; +}</div> </div> </div> @@ -432,115 +1752,731 @@ <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('assignment-s-01.c', 'assignment-s-01.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-01.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-01-c', 'assignment-s-01.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-01.c</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/assignment-secondary/assignment-s-01.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-01.c" 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-assignment-secondary-assignment-s-01-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to compute the sum and product of digits of an integer using user +defined functions. */ + +#include &lt;stdio.h&gt; + +int sum_of_digits(int); +int product_of_digits(int); + +int main() +{ + int num; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;num); + printf(&quot;\nSum of digits of %d = %d&quot;, num, sum_of_digits(num)); + printf(&quot;\nProduct of digits of %d = %d&quot;, num, product_of_digits(num)); + return 0; +} + +int sum_of_digits(int num) +{ + int sum = 0; + while (num &gt; 0) + { + sum += num % 10; + num /= 10; + } + return sum; +} + +int product_of_digits(int num) +{ + int product = 1; + while (num &gt; 0) + { + product *= num % 10; + num /= 10; + } + return product; +}</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('assignment-s-02.c', 'assignment-s-02.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-02.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-02-c', 'assignment-s-02.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-02.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-02.c</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/assignment-secondary/assignment-s-02.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-02.c" 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-assignment-secondary-assignment-s-02-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to reverse a non-negative integer using a function. */ + +#include &lt;stdio.h&gt; + +int reverse(int); + +int main() +{ + int num; + printf(&quot;Enter a non-negetive integer: &quot;); + scanf(&quot;%d&quot;, &amp;num); + if (num &lt; 0) + { + printf(&quot;\nOnly non-negetive integers are allowed.&quot;); + return 1; + } + printf(&quot;\nReverse of the integer %d = %d&quot;, num, reverse(num)); + return 0; +} + +int reverse(int num) +{ + int rev = 0; + while (num &gt; 0) + { + rev = (rev * 10) + (num % 10); + num /= 10; + } + return rev; +}</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('assignment-s-03.c', 'assignment-s-03.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-03.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-03-c', 'assignment-s-03.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-03.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-03.c</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/assignment-secondary/assignment-s-03.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-03.c" 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-assignment-secondary-assignment-s-03-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to compute the sum of the first n terms of the series using a function: +S=1−2+3−4+5−6+… */ + +#include &lt;stdio.h&gt; + +int sum_of_series(int); + +int main() +{ + int n; + printf(&quot;Enter the n: &quot;); + scanf(&quot;%d&quot;, &amp;n); + printf(&quot;\nSum of the first %d terms of the series = %d&quot;, n, sum_of_series(n)); + return 0; +} + +int sum_of_series(int n) +{ + int sum = 0; + int i; + for (i = 1; i &lt;= n; i++) + { + if (i % 2 == 0) + { + sum -= i; + } + else + { + sum += i; + } + } + return sum; +}</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('assignment-s-04.c', 'assignment-s-04.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-04.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-04-c', 'assignment-s-04.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-04.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-04.c</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/assignment-secondary/assignment-s-04.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-04.c" 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-assignment-secondary-assignment-s-04-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a function to check whether a number is prime or not. Use the same function to +generate all prime numbers less than 100. */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int isPrime(int); + +int main() +{ + int n, i; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (isPrime(n)) + { + printf(&quot;\nInput %d is a Prime Number.&quot;, n); + } + else + { + printf(&quot;\nInput %d is not a Prime Number.&quot;, n); + } + printf(&quot;\nPrime Numbers less than 100:&quot;); + for (i = 1; i &lt; 100; i++) + { + if (isPrime(i)) + { + printf(&quot; %d&quot;, i); + } + } + return 0; +} + +int isPrime(int n) +{ + if (n &lt;= 1) + return 0; + if (n == 2) + return 1; + if (n % 2 == 0) + return 0; + + int temp = (int)sqrt(n); + int i; + for (i = 3; i &lt;= temp; i += 2) + { + if (n % i == 0) + { + return 0; + } + } + return 1; +}</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('assignment-s-05.c', 'assignment-s-05.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-05.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-05-c', 'assignment-s-05.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-05.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-05.c</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/assignment-secondary/assignment-s-05.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-05.c" 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-assignment-secondary-assignment-s-05-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a function to check whether a given string is a palindrome. Use this function to +determine whether an entered string is Palindrome. */ + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; + +int isPalindrome(char[]); + +int main() +{ + char input[100]; + int len; + + printf(&quot;Enter the string (Max: 100 Character): &quot;); + fgets(input, sizeof(input), stdin); + len = strlen(input); + + if (len &gt; 0 &amp;&amp; input[len - 1] == &#x27;\n&#x27;) + { + input[len - 1] = &#x27;\0&#x27;; + } + + if (isPalindrome(input)) + { + printf(&quot;\nInput string \&quot;%s\&quot; is Palindrome.&quot;, input); + } + else + { + printf(&quot;\nInput string \&quot;%s\&quot; is not Palindrome&quot;, input); + } + + return 0; +} + +int isPalindrome(char str[]) +{ + char *start = str; + char *end; + int len = strlen(str); + + if (len == 0) + { + return 1; + } + + end = str + (len - 1); + + while (start &lt; end) + { + if (*start != *end) + { + return 0; + } + start++; + end--; + } + + return 1; +}</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('assignment-s-06.c', 'assignment-s-06.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-06.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-06-c', 'assignment-s-06.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-06.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-06.c</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/assignment-secondary/assignment-s-06.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-06.c" 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-assignment-secondary-assignment-s-06-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program using a function to compute and display all factors of a given number. */ + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +void display_factors(int); + +int main() +{ + int num, i; + printf(&quot;Please enter the number to get the factors from it : &quot;); + scanf(&quot;%d&quot;, &amp;num); + display_factors(num); + return 0; +} + +void display_factors(int num) { + int temp = abs(num); + int i; + + if (temp == 0) + { + printf(&quot;\n0 has infinitely many factors (all integers).&quot;); + exit(1); + } + + printf(&quot;\nThe factors of &#x27; %d &#x27; is :- &quot;, num); + printf(&quot;\nPositive : &quot;); + for (i = 1; i &lt;= temp; i++) + if (temp % i == 0) + printf(&quot; %d&quot;, i); + printf(&quot;\nNegative : &quot;); + for (i = 1; i &lt;= temp; i++) + if (temp % i == 0) + printf(&quot; %d&quot;, -i); +}</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('assignment-s-07.c', 'assignment-s-07.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-07.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-07-c', 'assignment-s-07.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-07.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-07.c</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/assignment-secondary/assignment-s-07.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-07.c" 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-assignment-secondary-assignment-s-07-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to swap two numbers using a macro (#define). */ + +// IMPOSSIBLE +/* It is impossible to swap two literal numbers defined using the +preprocessor directive #define. This is because #define performs simple +text substitution and does not create variables in memory that can be +manipulated or pointed to. */ + +// Using a Function-Like Macro + +#include &lt;stdio.h&gt; + +// Define the SWAP macro. +// The do-while(0) block is a common trick to ensure the macro behaves +// like a single statement, regardless of where it is used (e.g., inside an &#x27;if&#x27; statement). +#define SWAP(a, b, data_type) \ + do { \ + data_type temp = a; \ + a = b; \ + b = temp; \ + } while(0) + +int main() { + int num1 = 15; + int num2 = 42; + + printf(&quot;--- Before Swap ---\n&quot;); + printf(&quot;Number 1 (num1): %d\n&quot;, num1); + printf(&quot;Number 2 (num2): %d\n&quot;, num2); + + // Call the macro, passing the variables and their type + // The preprocessor replaces this line with the block of code defined above. + SWAP(num1, num2, int); + + printf(&quot;\n--- After Swap (using macro) ---\n&quot;); + printf(&quot;Number 1 (num1): %d\n&quot;, num1); + printf(&quot;Number 2 (num2): %d\n&quot;, num2); + + return 0; +}</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('assignment-s-08.c', 'assignment-s-08.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/assignment-secondary/assignment-s-08.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-assignment-secondary-assignment-s-08-c', 'assignment-s-08.c', 'https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-08.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">assignment-s-08.c</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/assignment-secondary/assignment-s-08.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-08.c" 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-assignment-secondary-assignment-s-08-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program that counts the number of occurrences of each alphabet (A-Z, a-z) in +the text entered using Command-Line Arguments. */ + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; + +int main(int argc, char *argv[]) +{ + int target[2], i, j, count[2], len; + for (target[0] = &#x27;A&#x27;, target[1] = &#x27;a&#x27;; target[0] &lt;= &#x27;Z&#x27;, target[1] &lt;= &#x27;z&#x27;; target[0]++, target[1]++) + { + count[0] = 0; + count[1] = 0; + for (i = 1; i &lt; argc; i++) + { + len = strlen(argv[i]); + for (j = 0; j &lt; len; j++) + { + if (argv[i][j] == target[0]) + { + count[0]++; + } + if (argv[i][j] == target[1]) + { + count[1]++; + } + } + } + if (count[0]) + { + printf(&quot;\n\&quot;%c\&quot; found %d times.&quot;, target[0], count[0]); + } + if (count[1]) + { + printf(&quot;\n\&quot;%c\&quot; found %d times.&quot;, target[1], count[1]); + } + } + return 0; +}</div> </div> </div> @@ -559,31 +2495,308 @@ <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('sudipto1.c', 'sudipto1.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/challenge/sudipto1.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-challenge-sudipto1-c', 'sudipto1.c', 'https://github.com/notamitgamer/bsc/blob/main/challenge/sudipto1.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">sudipto1.c</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/challenge/sudipto1.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/challenge/sudipto1.c" 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-challenge-sudipto1-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A smart home security controller monitors the state of several sensors to decide what action to take. + * Each second, the system reads data from sensors that can either be active or inactive. Based on the current + * state of all sensors, the controller must perform exactly one action, such as activating a warning, checking + * a specific zone, or declaring an intrusion. Write a C program that reads the sensor states as input and + * prints the corresponding system action. + -- Conditions: + * 1. You must determine exactly one action for every possible combination of sensor states. + * 2. You are not allowed to use any conditional statements (if, else if, else, or the ternary operator?). + * 3. You are not allowed to use logical operators. + * 4. You must use a single switch statement to control the program&#x27;s behaviour. + * 5. Loops may only be used for reading input, not for making decisions. + * 6. The program should handle all possible combinations of the sensors&#x27; active/inactive states and print the appropriate response each time. + -- Example (for understanding): + * If all sensors are inactive, the system should remain idle. + * If some sensors are active, the system should issue warnings or alerts based on the situation. + * If all sensors are active, the system should declare a confirmed intrusion. + */ + +/* + * This program monitors the state of four sensors (Door, Window, Motion, Glass Break) + * and determines the appropriate action without using any conditional (if, else) + * or logical (&amp;&amp;, ||) operators. + * + * It works by combining the state of all sensors into a single integer value + * using bitmasking. Each bit in the integer represents the state of one sensor + * (1 for active, 0 for inactive). This combined state is then used in a single + * switch statement to select the correct action for every possible combination. + * + * Then, enter the state of the four sensors separated by spaces, + * for example: 1 0 1 0 + */ + +/* Author - Amit Dutta, Date - 12th October, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + + // variables to hold the state of a sensor (0 or 1) + int doorSensorState, windowSensorState, motionSensorState, glassbreakSensorState; + + // variable to check the combined state of all four sensor + int combinedState = 0; + + // a invalid flag to check the input are valid or not + unsigned int invalidFlag; + + // printing the way to usage the program + printf(&quot;------ Home Security Controller ------\n&quot;); + printf(&quot;Enter sensor states (1 for active, 0 for inactive).\n&quot;); + printf(&quot;Format: [Door] [Window] [Motion] [Glass Break]\n&quot;); + printf(&quot;Example: 0 1 1 0\n&quot;); + printf(&quot;Enter states (or press Ctrl+D for MacOS or Linux / Ctrl+Z for Windows to exit): &quot;); + + // doing the main calculation + // chacking the combined state and taking a decision + while (scanf(&quot;%d %d %d %d&quot;, &amp;doorSensorState, &amp;windowSensorState, &amp;motionSensorState, &amp;glassbreakSensorState) == 4) + { + // validating input + // The expression (variable &amp; ~1) results in 0 only if &#x27;variable&#x27; is 0 or 1. + // For any other positive number, it&#x27;s non-zero. + // We combine all checks with a bitwise OR. If any sensor state is invalid, + // the flag will become non-zero. + invalidFlag = (doorSensorState &amp; ~1) | (windowSensorState &amp; ~1) | (motionSensorState &amp; ~1) | (glassbreakSensorState &amp; ~1); + + // Combine the four sensor states into a single integer using bitwise operations. + // This creates a unique number from 0 to 15 for each possible combination. + // Bit 0: Door Sensor + // Bit 1: Window Sensor + // Bit 2: Motion Sensor + // Bit 3: Glass Break Sensor + combinedState = (glassbreakSensorState &lt;&lt; 3) | (motionSensorState &lt;&lt; 2) | (windowSensorState &lt;&lt; 1) | doorSensorState; + + // If the invalid_input_flag is non-zero, we add 16 to the state. + // This pushes it outside the 0-15 range and forces the &#x27;default&#x27; case in the switch. + // We achieve this by multiplying the flag (which is &gt; 0) by 16. + combinedState += invalidFlag * 16; + + // printing the given state + printf(&quot;\n\nState : [Door : %d, Window : %d, Motion : %d, Glass Break : %d]\nState Id : %d&quot;, + doorSensorState, windowSensorState, motionSensorState, glassbreakSensorState, combinedState); + printf(&quot;\nSystem Action : &quot;); + + // taking decision based on combined state + // A single switch statement controls the program&#x27;s behavior. + // It handles all 2^4 = 16 possible combinations of sensor states, + // ensuring exactly one action is taken for every scenario. + switch (combinedState) + { + case 0: // Binary: 0000 + printf(&quot;System Idle. All sensors inactive.\n&quot;); + break; + case 1: // Binary: 0001 + printf(&quot;Check front door camera.\n&quot;); + break; + case 2: // Binary: 0010 + printf(&quot;Check window sensors.\n&quot;); + break; + case 3: // Binary: 0011 + printf(&quot;Warning: Perimeter breach suspected. Check doors and windows.\n&quot;); + break; + case 4: // Binary: 0100 + printf(&quot;Check interior cameras for movement.\n&quot;); + break; + case 5: // Binary: 0101 + printf(&quot;Warning: Potential entry and movement detected. Check front door and interior. Ask for patrol.\n&quot;); + break; + case 6: // Binary: 0110 + printf(&quot;Warning: Potential entry and movement detected. Check windows and interior. Ask for patrol.\n&quot;); + break; + case 7: // Binary: 0111 + printf(&quot;Alert: High probability of unauthorized entry. Ask for patrol.\n&quot;); + break; + case 8: // Binary: 1000 + printf(&quot;Alert: Glass break detected. High-priority event. Ask for patrol.\n&quot;); + break; + case 9: // Binary: 1001 + printf(&quot;Severe Alert: Forced entry likely (door + glass). Activate Alarm and Contact authorities.\n&quot;); + break; + case 10: // Binary: 1010 + printf(&quot;Severe Alert: Forced entry likely (window + glass). Activate Alarm and Contact authorities.\n&quot;); + break; + case 11: // Binary: 1011 + printf(&quot;Intrusion Alert: Multiple perimeter breaches. Activate Alarm and Contact authorities.\n&quot;); + break; + case 12: // Binary: 1100 + printf(&quot;Intrusion Alert: Confirmed interior presence after breach. Activate Alarm and Contact authorities.\n&quot;); + break; + case 13: // Binary: 1101 + printf(&quot;INTRUSION CONFIRMED! Activate maximum response protocol. Activate Alarm and Contact authorities.\n&quot;); + break; + case 14: // Binary: 1110 + printf(&quot;INTRUSION CONFIRMED! Activate maximum response protocol. Activate Alarm and Contact authorities.\n&quot;); + break; + case 15: // Binary: 1111 + printf(&quot;CATASTROPHIC EVENT! ALL SENSORS TRIGGERED. ACTIVATE ALARM AND CONTACT COPS.\n&quot;); + break; + default: + // This case should not be reached with valid 0/1 input but is included for completeness. + printf(&quot;Error: Invalid sensor state detected.\n&quot;); + break; + } + + // discarding extra characters (if any) left + while (getchar() != &#x27;\n&#x27;) + ; + + // asking for next set of input + printf(&quot;\nEnter next set of states: &quot;); + } + printf(&quot;\nSecurity system shutting down.\n&quot;); +}</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('sudiptoown01.c', 'sudiptoown01.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/challenge/sudiptoown01.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-challenge-sudiptoown01-c', 'sudiptoown01.c', 'https://github.com/notamitgamer/bsc/blob/main/challenge/sudiptoown01.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">sudiptoown01.c</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/challenge/sudiptoown01.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/challenge/sudiptoown01.c" 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-challenge-sudiptoown01-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* + * A smart home security controller monitors the state of several sensors to decide what action to take. + * Each second, the system reads data from sensors that are either an active or inactive. Based on the current + * state of all sensors, the controller must perform exactly one action, such as activating a warning, checking + * a specific zone, or declaring an intrusion. Write a C program that reads the sensor status as input and + * prints the corresponding system action. + * Hints: + * 1. The most determinative action wins for every possible combination of sensor states. + * 2. You are not allowed to use any conditional statements (if, else if, else, or the ternary operator?). + * 3. You are not allowed to use logical operators. + * 4. You must use a single switch statement to control the program&#x27;s behavior. + * 5. The program should handle all possible combinations of the sensors&#x27; active/inactive states and print the appropriate response each time. + * 6. All sensors are inactive, the system should remain idle. + * 7. If some sensors are active, the system should issue warnings or alerts based on the situation. + * 8. If all sensors are active, the system should declare a confirmed intrusion. + * Solution: + * We can solve this problem simply by assigning each case its own distinct integer. + * There are 2 possibilities for a sensor and therefore there are 2^4 = 16 cases. + * Using arrays we can assign each case its own index value and print it as per the encoded binary integer. + */ +#include &lt;stdio.h&gt; + +int casekey(int door, int window, int motion, int glass) { + int key = (door &lt;&lt; 3) | (window &lt;&lt; 2) | (motion &lt;&lt; 1) | glass; + return key; +} + +int main() { + int door, window, motion, glass, key; + char choice; + + static const char *action[16] = { + &quot;IDLE&quot;, &quot;CHECK WINDOW&quot;, &quot;WARN MOTION&quot;, &quot;WARN MOTION WINDOW&quot;, + &quot;CHECK DOOR&quot;, &quot;WARN DOOR WINDOW&quot;, &quot;INTRUSION SUSPECTED&quot;, &quot;INTRUSION CONFIRMED&quot;, + &quot;GLASS ONLY&quot;, &quot;DOOR GLASS&quot;, &quot;MOTION GLASS&quot;, &quot;MOTION WINDOW GLASS&quot;, + &quot;DOOR WINDOW&quot;, &quot;DOOR WINDOW GLASS&quot;, &quot;DOOR MOTION GLASS&quot;, &quot;ALL SENSORS&quot; + }; + + do { + printf(&quot;Sensors: Door, Window, Motion, Glass\n&quot;); + printf(&quot;Enter the state of each sensor in binary (0 or 1): &quot;); + scanf(&quot;%d %d %d %d&quot;, &amp;door, &amp;window, &amp;motion, &amp;glass); + + key = casekey(door, window, motion, glass); + printf(&quot;Action: %s\n&quot;, action[key]); + + printf(&quot;Want to continue? (y/n): &quot;); + scanf(&quot; %c&quot;, &amp;choice); + printf(&quot;\n&quot;); + } while (choice == &#x27;y&#x27; || choice == &#x27;Y&#x27;); + + return 0; +}</div> </div> </div> @@ -602,31 +2815,143 @@ <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('KI001.c', 'KI001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/khurapati-idea/KI001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-khurapati-idea-KI001-c', 'KI001.c', 'https://github.com/notamitgamer/bsc/blob/main/khurapati-idea/KI001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">KI001.c</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/khurapati-idea/KI001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/khurapati-idea/KI001.c" 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-khurapati-idea-KI001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +// khurapati idea no. : 1 +// Idea : we can use the side effect of printf function to get length of any string or number +// Author - Amit Dutta, Date - 16-10-2025 + +#include &lt;stdio.h&gt; +int main() +{ + // testing number + int num, len = -13 /* here minus 13 because we will remove the massage characters in line 10 */; + printf(&quot;Enter a number to get the length : &quot;); + scanf(&quot;%d&quot;, &amp;num); + len += printf(&quot;Your input : %d&quot;, num); // here the &quot;Your input : &quot;, this 13 characters are extra + printf(&quot;\nLength : %d&quot;, len); + + // testing char + char a[20]; + len = -13; + while (getchar() != &#x27;\n&#x27;) + ; + printf(&quot;\nEnter a word to get the length : &quot;); + scanf(&quot;%19s&quot;, &amp;a); + len += printf(&quot;Your input : %s&quot;, a); // here the &quot;Your input : &quot;, this 13 characters are extra + printf(&quot;\nLength : %d&quot;, len); + return 0; +}</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('KI002.c', 'KI002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/khurapati-idea/KI002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-khurapati-idea-KI002-c', 'KI002.c', 'https://github.com/notamitgamer/bsc/blob/main/khurapati-idea/KI002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">KI002.c</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/khurapati-idea/KI002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/khurapati-idea/KI002.c" 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-khurapati-idea-KI002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Author - Amit Dutta, Date - 05th November, 2025 */ + +/* Plan - checking for edge case */ + +#include &lt;stdio.h&gt; +int main() +{ + printf(&quot;Starting.....\n&quot;); + + for (int i = 1; ; i++) + { + printf(&quot;i = %d\n&quot;, i); + } + return 0; +}</div> </div> </div> @@ -645,969 +2970,6355 @@ <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('luc001.c', 'luc001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc001-c', 'luc001.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc001.c</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/letusc/luc001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc001.c" 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-letusc-luc001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Temperature of a city in fahrenheit degrees is input through +the keyboard. WAP to convert this temperature into Centigrade +degrees. */ +/* Author - Amit Dutta, Date - 13 sep, 2025 */ +/* Chapter 1; Page 19; Question NO.: F(a) */ + +#include&lt;stdio.h&gt; +int main() { + float f, c; + printf(&quot;Enter the temperature of city in Fahrenheit : &quot;); + scanf(&quot;%f&quot;, &amp;f); + // formula (F - 32) 5/9 + c = ((f - 32) * 5) / 9; + printf(&quot;\nTemperature in centigrade : %f&quot;, c); + return 0; +} +</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('luc002.c', 'luc002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc002-c', 'luc002.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc002.c</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/letusc/luc002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc002.c" 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-letusc-luc002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* The length and breadth of a rectangle and radius of a circle +are input through the keyboard. Write a program to calculate the +area and perimeter of the rectangle, and the area and circumference +of the circle. */ +/* Author - Amit Dutta, Date - 16th SEP, 2025 */ +/* Let Us C; Page - 19; Chap- 1; QNo.: F(b) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double len, bre, r, area_r, per, area_c, cir; + printf(&quot;Enter the length and breadth of the rectangle : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;len, &amp;bre); + printf(&quot;Enter the Radius of the circle : &quot;); + scanf(&quot;%lf&quot;, &amp;r); + area_r = len * bre; + per = 2 * (len + bre); + area_c = M_PI * r * r; + cir = 2 * M_PI * r; + printf(&quot;\nArea of Rectangle : %lf&quot; + &quot;\nPerimeter of Rectangle : %lf&quot; + &quot;\nArea of Circle : %lf&quot; + &quot;\nCircumference of Circle : %lf&quot;, + area_r, per, area_c, cir); + return 0; +} +</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('luc003.c', 'luc003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc003-c', 'luc003.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc003.c</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/letusc/luc003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc003.c" 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-letusc-luc003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Paper of size AO has dimensions 1189 mm x 841 mm. +Each subsequent size A(n) is defined as A(n-1) cut in +half, parallel to its shorter sides. Thus, paper of +size A1 would have dimensions 841 mm x 594 mm. Write +a program to calculate and print paper sizes A0,� +A1,�A2,�...�A8. */ +/* Author - Amit Dutta, Date - 16th SEP, 2025 */ +/* Let Us C; Page - 19; Chap- 1; QNo.: F(c) */ + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + double s_long = 1189.0, s_short = 841.0, temp; + int i; + printf(&quot;A0 Dimension : %g mm x %g mm&quot;, floor(s_long), floor(s_short)); + for (i = 1; i &lt;= 8; i++) { + temp = s_long; + s_long = s_short; + s_short = temp / 2; + printf(&quot;\nA%d Dimension : %g mm x %g mm&quot;, i, floor(s_long), floor(s_short)); + } + return 0; +} +</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('luc004.c', 'luc004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc004-c', 'luc004.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc004.c</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/letusc/luc004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc004.c" 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-letusc-luc004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* If a five digit number is input through the keyboard, +write a program to calculate the sum of it&#x27;s digit. +(Hint : Use the modulus operator %) */ +/* Author - Amit Dutta, Date - 28th SEP, 2025 */ +/* Let Us C; Page - 37; Chap- 2; QNo.: G(a) */ + +#include &lt;stdio.h&gt; +int main() +{ + int inp, result = 0, i, temp; + printf(&quot;Enter a five digit number : &quot;); + scanf(&quot;%d&quot;, &amp;inp); + if (inp &lt; 10000 || inp &gt; 99999) + { + printf(&quot;\nPlease enter a valid five digit number.&quot;); + return 1; + } + temp = inp; + for (i = 1; i &lt;= 5; i++) + { + result = result + (inp % 10); + inp = inp / 10; + } + printf(&quot;\nSum of the digit &#x27;%d&#x27; is : %d&quot;, temp, result); + return 0; +}</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('luc005.c', 'luc005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc005-c', 'luc005.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc005.c</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/letusc/luc005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc005.c" 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-letusc-luc005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to recive Cartesian +co-ordinates (x, y) of a point and convert +them into Polar co-ordinates (r, phi) + Hint : r = sqrt (x^2 + y^2) and phi = tan^-1 (y/x) */ +/* Author - Amit Dutta, Date - 28th SEP, 2025 */ +/* Let Us C; Page - 37; Chap- 2; QNo.: G(b) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double x, y, r, phi; + printf(&quot;Enter the Cartesian Co-Ordinates in this format &#x27;x, y&#x27; : &quot;); + scanf(&quot;%lf, %lf&quot;, &amp;x, &amp;y); + r = sqrt(pow(x, 2) + pow(y, 2)); + phi = atan2(y, x); + printf(&quot;\nPolar Co-Ordinates are : (%g, %g Rad)&quot;, r, phi); + return 0; +}</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('luc006.c', 'luc006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc006-c', 'luc006.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc006.c</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/letusc/luc006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc006.c" 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-letusc-luc006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to receive values of latitude (L1, L2) and longitude +(G1, G2), in degrees, of two places on the earth and output the distance +(D) between them in nautical miles. The formula for distance in nautical +miles is : + D = 3963 cos^-1(sin L1 sin L2 + cos L1 cos L2 * cos(G2 - G1)) +*/ +/* Author - Amit Dutta, Date - 29th SEP, 2025 */ +/* Let Us C, Chap - 2, Page - 37, Qn no.: G(c) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double l1, l2, g1, g2, d; + printf(&quot;Enter the Latitude in &#x27;L1, L2&#x27; format : &quot;); + scanf(&quot;%lf, %lf&quot;, &amp;l1, &amp;l2); + printf(&quot;Enter the Longitude in &#x27;G1, G2&#x27; format : &quot;); + scanf(&quot;%lf, %lf&quot;, &amp;g1, &amp;g2); + // Converting degree to radian because function from math.h use radian not degree + l1 = l1 * (M_PI / 180); + l2 = l2 * (M_PI / 180); + g1 = g1 * (M_PI / 180); + g2 = g2 * (M_PI / 180); + d = 3963 * acos(sin(l1) * sin(l2) + cos(l1) * cos(l2) * cos(g2 - g1)); + printf(&quot;Distance in nautical miles : %g&quot;, d); + return 0; +}</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('luc007.c', 'luc007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc007-c', 'luc007.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc007.c</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/letusc/luc007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc007.c" 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-letusc-luc007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Wind-chill factor is the felt air temperature on exposed skin due to wind. +The wind-chill temperature is always lower than the air temperature, and is +calculated as per the following formula. + wcf = 35.74 + 0.6215t + (0.4275t - 35.75) * v^0.16 +Where t is temperature and v is wind velocity. Write a program to receive +values of t and v and calcualate wind-chill factor (wcf). */ +/* Author - Amit Dutta, Date - 30th SEP, 2025 */ +/* Let Us C, Chap - 2, Page - 37, Qn No.: G(d) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double t, v, wcf; + printf(&quot;Enter the temperature and velociy of the wind : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;t, &amp;v); + wcf = 35.74 + (0.6215 * t) + (((0.4275 * t) - 35.75) * pow(v, 0.16)); + printf(&quot;\nWind-chill factor (wcf) : %g&quot;, wcf); + return 0; +}</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('luc008.c', 'luc008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc008-c', 'luc008.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc008.c</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/letusc/luc008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc008.c" 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-letusc-luc008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* If value of an angle is input through the keyboard, +write a program to print all its trigonometric ratios. */ +/* Author - Amit Dutta, Date - 30th SEP, 2025 */ +/* Let Us C, Chap - 2, Page - 37, Qn No.: G(e) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double inp, rsin, rcos, rtan, rcosec, rsec, rcot; + printf(&quot;Enter the Angle in degree : &quot;); + scanf(&quot;%lf&quot;, &amp;inp); + inp = inp * (M_PI / 180); //changing degree to radian + rsin = sin(inp); + rcos = cos(inp); + rtan = tan(inp); + rcosec = 1 / rsin; + rsec = 1 / rcos; + rcot = 1 / rtan; + printf(&quot;\nTrigonometric ratios :-&quot; + &quot;\nsin = %g &quot; + &quot;\ncos = %g&quot; + &quot;\ntan = %g&quot; + &quot;\ncosec = %g&quot; + &quot;\nsec = %g&quot; + &quot;\ncot = %g&quot;, + rsin, rcos, rtan, rcosec, rsec, rcot); + return 0; +}</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('luc009.c', 'luc009.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc009.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc009-c', 'luc009.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc009.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc009.c</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/letusc/luc009.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc009.c" 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-letusc-luc009-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Two numbers are input through the keyboard into two locations +C and D. Write a program to interchange the contents of C and D. */ +/* Author - Amit Dutta, Date - 30th SEP, 2025 */ +/* Let Us C, Chap - 2, Page - 37, Qn No.: G(d) */ + +#include &lt;stdio.h&gt; +int main() +{ + double a, b; + printf(&quot;Enter the two number A and B : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;a, &amp;b); + printf(&quot;\nBefore Interchange : &quot;); + printf(&quot;\nA = %g (Memory location = %p)&quot;, a, &amp;a); + printf(&quot;\nB = %g (Memory location = %p)&quot;, b, &amp;b); + a = a + b; + b = a - b; + a = a - b; + printf(&quot;\nAfter Interchange :&quot;); + printf(&quot;\nA = %g (Memory location = %p)&quot;, a, &amp;a); + printf(&quot;\nB = %g (Memory location = %p)&quot;, b, &amp;b); + return 0; +}</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('luc010.c', 'luc010.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc010.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc010-c', 'luc010.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc010.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc010.c</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/letusc/luc010.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc010.c" 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-letusc-luc010-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A five-digit number is entered through the keyboard. Write a program +to obtain the reversed number and to etermine whether the original and reversed +numbers are equal or not. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap - 3, Page - 53, Qn No.: f(a) */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, rev, temp, i; + printf(&quot;Please enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + if (num &lt; 10000 || num &gt; 99999) + { + printf(&quot;\nPlease enter a five digit number.&quot;); + return 1; + } + temp = num; + for (i = 1; i &lt;= 5; i++) + { + rev = (rev * 10) + num % 10; + num = num / 10; + } + printf(&quot;\nReverse of the Input number : %d&quot;, rev); + if (rev == temp) + printf(&quot;\nOriginal and reversed numbers are equal.&quot;); + else + printf(&quot;\nOrigianl and reversed numbers are not equal.&quot;); + return 0; +}</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('luc011.c', 'luc011.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc011.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc011-c', 'luc011.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc011.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc011.c</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/letusc/luc011.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc011.c" 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-letusc-luc011-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* If ages of Ram, Shyam and Ajay are input through the keyboard, +write a program to determine the youngest of the three. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(b) */ + +#include &lt;stdio.h&gt; +int main() +{ + int ram, shyam, ajay; + printf(&quot;Please enter the age of Ram, Shyam and Ajay : &quot;); + scanf(&quot;%d %d %d&quot;, &amp;ram, &amp;shyam, &amp;ajay); + if (ram == shyam || ram == ajay || shyam == ajay) + printf(&quot;\nThree must have different age.&quot;); + if (ram &lt; shyam &amp;&amp; ram &lt; ajay) + printf(&quot;\nRam is the youngest. Age : %d&quot;, ram); + if (shyam &lt; ram &amp;&amp; shyam &lt; ajay) + printf(&quot;\nShyam is the youngest. Age : %d&quot;, shyam); + if (ajay &lt; ram &amp;&amp; ajay &lt; shyam) + printf(&quot;\nAjay is the youngest. Age : %d&quot;, ajay); + return 0; +}</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('luc012.c', 'luc012.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc012.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc012-c', 'luc012.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc012.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc012.c</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/letusc/luc012.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc012.c" 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-letusc-luc012-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check whether a triangle is valid or not, +if three angles of the triangle are entered through the keyboard. +A triangle is valid if the sum of all the three angles is equal to 180 degrees. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(c) */ + +#include &lt;stdio.h&gt; +int main() +{ + double angle1, angle2, angle3, sum; + printf(&quot;Enter the value of the three angle of the triangle : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;angle1, &amp;angle2, &amp;angle3); + sum = angle1 + angle2 + angle3; + if (sum == 180.0) + printf(&quot;\nThis Triangle is a valid one.&quot;); + else + printf(&quot;\nThis Triangle is not valid. Sum of the angles : %g&quot;, sum); + return 0; +}</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('luc013.c', 'luc013.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc013.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc013-c', 'luc013.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc013.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc013.c</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/letusc/luc013.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc013.c" 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-letusc-luc013-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the absolute value +of a number entered through the keyboard. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(d) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double num; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%lf&quot;, &amp;num); + num = abs(num); + printf(&quot;\nAbsolute value of the input is : %g&quot;, num); + return 0; +}</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('luc014.c', 'luc014.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc014.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc014-c', 'luc014.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc014.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc014.c</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/letusc/luc014.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc014.c" 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-letusc-luc014-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Given the length and breadth of a rectangle, write a program to find +whether the area of the rectangle is greater than it&#x27;s perimeter. +For example, the area of the rectangle with length = 5 and breadth = 4 +is greater than its perimeter. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(e) */ + +#include &lt;stdio.h&gt; +int main() +{ + double len, bre, area, peri; + printf(&quot;Enter the length and breadth of the rectangle : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;len, &amp;bre); + area = len * bre; + peri = 2 * (len + bre); + if (area &gt; peri) + printf(&quot;\nThe area of the rectangle is greater than it&#x27;s perimeter.&quot;); + else if (area &lt; peri) + printf(&quot;\nThe area of the rectangle is lower than it&#x27;s perimeter.&quot;); + else + printf(&quot;\nThe area of the rectangle is same as it&#x27;s perimeter.&quot;); + return 0; +}</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('luc015.c', 'luc015.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc015.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc015-c', 'luc015.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc015.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc015.c</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/letusc/luc015.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc015.c" 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-letusc-luc015-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Given three points (x1, y1), (x2, y2), and (x3, y3), +write a program to check if the three poins fall on one straight line. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(f) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#define EPSILON 0.0001 +// Define a small tolerance value (EPSILON) for safe floating-point comparison +// This is critical because of minor rounding errors in computer arithmetic. +int main() +{ + double x1, x2, x3, y1, y2, y3, area; + printf(&quot;Enter the point A(x1, y1) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;x1, &amp;y1); + printf(&quot;Enter the point B(x2, y2) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;x2, &amp;y2); + printf(&quot;Enter the point C(x3, y3) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;x3, &amp;y3); + area = 0.5 * ((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2))); + if (fabs(area) &lt; EPSILON) // abs() for integer, fabs() for float, double + printf(&quot;\nA(%g, %g), B(%g, %g) and C(%g, %g) points fall on one straight line.&quot;, x1, y1, x2, y2, x3, y3); + else + printf(&quot;\nA(%g, %g), B(%g, %g) and C(%g, %g) points doesn&#x27;t fall on one straight line.&quot;, x1, y1, x2, y2, x3, y3); + return 0; +}</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('luc016.c', 'luc016.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc016.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc016-c', 'luc016.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc016.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc016.c</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/letusc/luc016.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc016.c" 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-letusc-luc016-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Given the coordiantes (x, y) of center of a circle and its radius, +write a program that will determine whether a point lies inside the circle, +on the circle or outside the circle. (Hint : Use sqrt() and pow() functions.) */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(g) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +// Define a small tolerance value (EPSILON) for reliable floating-point comparison +#define EPSILON 0.0001 + +int main() +{ + double h, k; + double R; + double x, y; + double distance_sq; + printf(&quot;Enter the center coordinates (h, k) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;h, &amp;k); + printf(&quot;Enter the radius (R) : &quot;); + scanf(&quot;%lf&quot;, &amp;R); + printf(&quot;Enter the point P coordinates (x, y) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;x, &amp;y); + distance_sq = pow(x - h, 2) + pow(y - k, 2); + double radius_sq = R * R; + // Case 1: On the circle (D^2 = R^2) - Use EPSILON for safety! + if (fabs(distance_sq - radius_sq) &lt; EPSILON) + { + printf(&quot;The point P(%g, %g) lies ON THE CIRCLE.\n&quot;, x, y); + } + // Case 2: Inside the circle (D^2 &lt; R^2) + else if (distance_sq &lt; radius_sq) + { + printf(&quot;The point P(%g, %g) lies INSIDE THE CIRCLE.\n&quot;, x, y); + } + // Case 3: Outside the circle (D^2 &gt; R^2) + else + { + printf(&quot;The point P(%g, %g) lies OUTSIDE THE CIRCLE.\n&quot;, x, y); + } + return 0; +}</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('luc017.c', 'luc017.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc017.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc017-c', 'luc017.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc017.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc017.c</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/letusc/luc017.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc017.c" 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> - </div> - + <!-- Embedded Code Storage --> + <div id="code-letusc-luc017-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Given a point (x, y), write a program to find out if it lies on X-axis, Y-axis or origin. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(h) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#define EPSILON 0.00001 + +int main() +{ + double x, y; + printf(&quot;Enter the point P(x, y) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;x, &amp;y); + if (fabs(x) &lt; EPSILON &amp;&amp; fabs(y) &lt; EPSILON) + printf(&quot;\nPoint P(%g, %g) lies on the origin.&quot;, x, y); + else if (fabs(x) &lt; EPSILON) + printf(&quot;\nPoint P(%g, %g) lies on the Y-Axis.&quot;, x, y); + else if (fabs(y) &lt; EPSILON) + printf(&quot;\nPoint P(%G, %g) lies on the X-Axis.&quot;, x, y); + else + printf(&quot;\nThe point P(%g, %g) lies in a QUADRANT (not on an axis or the origin).&quot;, x, y); + return 0; +}</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('luc018-logic.c', 'luc018-logic.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc018-logic.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc018-logic-c', 'luc018-logic.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc018-logic.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc018-logic.c</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/letusc/luc018-logic.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018-logic.c" 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-letusc-luc018-logic-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* According to Gregorian calender, it was Monday on the date 01/01/01. +Write a program to find out what is the day on 1st January of any input year. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(i) */ + +#include &lt;stdio.h&gt; + +/** + * @brief Determines if a given year is a leap year. + * * The rule: A year is a leap year if it is divisible by 4, UNLESS it is + * divisible by 100 but NOT by 400. + * * @param year The year to check. + * @return 1 if it is a leap year, 0 otherwise. + */ +int is_leap(int year) { + // Check if divisible by 400 OR (divisible by 4 AND not divisible by 100) + if ((year % 400 == 0) || (year % 4 == 0 &amp;&amp; year % 100 != 0)) { + return 1; + } + return 0; +} + +/** + * @brief Calculates the day of the week for January 1st of the given year. + * * The base date is 01/01/01, which was a Monday (index 1). + * * Day Mapping: 0:Sunday, 1:Monday, 2:Tuesday, 3:Wednesday, 4:Thursday, 5:Friday, 6:Saturday + */ +int main() { + long long year; // Use long long for year input if years far in the future/past are tested + int i; + long long total_days = 0; + int day_index; + + // Day names array for output + const char *day_names[] = {&quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;}; + + printf(&quot;Enter the year (e.g., 2025): &quot;); + if (scanf(&quot;%lld&quot;, &amp;year) != 1 || year &lt; 1) { + printf(&quot;Invalid year input. Please enter a positive integer year (&gt;= 1).\n&quot;); + return 1; + } + + // --- Core Logic: Calculate Total Days --- + + // We only need to consider the years that have *passed* before the target year. + // So, we count days from the end of year 0 up to the end of year (year - 1). + int years_passed = year - 1; + + // 1. Calculate the number of leap days up to the end of year (year - 1) + // Formula based on Gregorian calendar rules for years Y-1: + // (Y-1)/4 - (Y-1)/100 + (Y-1)/400 + long long leap_years = years_passed / 4 - years_passed / 100 + years_passed / 400; + + // 2. Total days = (Number of years * 365) + (Number of leap years) + // Note: The loop method (below) is more intuitive but the formula is faster. + // We will use the direct formula for efficiency. + total_days = years_passed * 365 + leap_years; + + // --- Alternate Loop Method (for conceptual simplicity) --- + /* + for (i = 1; i &lt; year; i++) { + total_days += 365; + if (is_leap(i)) { + total_days += 1; // Add 1 for the leap day + } + } + */ + + // --- Determine the Day of the Week --- + + // Since 01/01/01 was Monday (index 1), we use the following setup: + // Index 1 corresponds to Monday. + // The calculation gives the number of days *past* the Monday start (01/01/01). + // The modulo operation gives the remainder (0-6). + + // 0 days elapsed (Year 1): total_days=0. (0 + 1) % 7 = 1 (Monday). Correct. + // 365 days elapsed (Year 2): total_days=365. (365 + 1) % 7 = 2 (Tuesday). Correct. (365 mod 7 = 1, 1+1 = 2) + + day_index = (total_days + 1) % 7; + + // Correct the Day Index to match the array (0:Sun, 1:Mon, ..., 6:Sat) + // The +1 adjusts for the Monday starting point (index 1). + + printf(&quot;\nOn January 1st, %lld, the day was: **%s**.\n&quot;, year, day_names[day_index]); + + return 0; +}</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('luc018.c', 'luc018.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc018.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc018-c', 'luc018.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc018.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc018.c</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/letusc/luc018.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018.c" 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-letusc-luc018-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* According to Gregorian calender, it was Monday on the date 01/01/01. +if any year is input through the keyboard write a program to find out +what is the day on 1st January of this year. */ +/* Author - Amit Dutta, Date - 1st OCT, 2025 */ +/* Let Us C, Chap- 3, Page - 53, Qn No.: f(i) */ + +#include &lt;stdio.h&gt; + +int is_leap(int year) { + if ((year % 400 == 0) || (year % 4 == 0 &amp;&amp; year % 100 != 0)) { + return 1; + } + return 0; +} + +int main() { + long long year; // long long for year input if years far in the future/past are tested + int i; + long long total_days = 0; + int day_index; + + // Day names array for output + const char *day_names[] = {&quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;}; + + printf(&quot;Enter the year (e.g., 2025): &quot;); + if (scanf(&quot;%lld&quot;, &amp;year) != 1 || year &lt; 1) { + printf(&quot;Invalid year input. Please enter a positive integer year (&gt;= 1).\n&quot;); + return 1; + } + int years_passed = year - 1; + long long leap_years = years_passed / 4 - years_passed / 100 + years_passed / 400; + total_days = years_passed * 365 + leap_years; + day_index = (total_days + 1) % 7; + printf(&quot;\nOn January 1st, %lld, the day was: %s.\n&quot;, year, day_names[day_index]); + return 0; +}</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('luc019.c', 'luc019.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc019.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc019-c', 'luc019.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc019.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc019.c</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/letusc/luc019.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc019.c" 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-letusc-luc019-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* If the length of three sides of a triangle are entered through the +keyboard, write a program to check whether the triangle is an isosceles, +an equilateral, a scalene or a right-angled triangle. */ +/* Author - Amit Dutta, Date - 3rd OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 71, Qn No.: D(a) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +#define EPSILON 0.000001 +/* EPSILON is used to compare double values for approximate equality, +mitigating floating-point precision errors. */ + +int main() +{ + double side1, side2, side3; + printf(&quot;Please enter the length of three side of the triangle : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;side1, &amp;side2, &amp;side3); + if (side1 &lt; 1 || side2 &lt; 1 || side3 &lt; 1) + { + printf(&quot;\nLength of a side of triangle should be a positive integer.&quot;); + return 1; + } + if (side1 + side2 &lt; side3 || side1 + side3 &lt; side2 || side2 + side3 &lt; side1) + { + printf(&quot;\nEntered triangle is not VALID.&quot;); + return 1; + } + // isosceles check + if (side1 == side2 || side2 == side3 || side3 == side1) + printf(&quot;\nEntered triangle is a ISOSCELES triangle.&quot;); + else + printf(&quot;\nEntered triangle is NOT a ISOSCELES triangle.&quot;); + // equilateral check + if (side1 == side2 &amp;&amp; side2 == side3) + printf(&quot;\nEntered triangle is a EQUILATERAL triangle.&quot;); + else + printf(&quot;\nEntered triangle is NOT a EQUILATERAL triangle.&quot;); + // scalene check + if (side1 != side2 &amp;&amp; side2 != side3) + printf(&quot;\nEntered triangle is a SCALENE triangle.&quot;); + else + printf(&quot;\nEntered triangle is NOT a SCALENE triangle.&quot;); + // right-angle check + if (fabs(((side1 * side1) + (side2 * side2)) - (side3 * side3)) &lt; EPSILON || + fabs(((side2 * side2) + (side3 * side3)) - (side1 * side1)) &lt; EPSILON || + fabs(((side3 * side3) + (side1 * side1)) - (side2 * side2)) &lt; EPSILON) + printf(&quot;\nEntered triangle is a RIGHT-ANGLED triangle.&quot;); + else + printf(&quot;\nEntered triangle is NOT a RIGHT-ANGLED triangle.&quot;); + return 0; +}</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('luc020.c', 'luc020.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc020.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc020-c', 'luc020.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc020.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc020.c</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/letusc/luc020.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc020.c" 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-letusc-luc020-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* In digital world colors are specified in Red-Green-Blue (RGB) format, +with values of R, G, B varying on an integer scale from 0 to 255. In print +publishing the colors are mentioned in Cyan-Magenta-Yellow-Black (CMYK) format, +with values of C, M, Y, and K varying on a real scale from 0.0 to 1.0. +Write a program that converts RGB color to CMYK color as per the following formulae: + White = Max(Red/255, Green/255, Blue/255) + Cyan = (White-Red/255) / White + Magenta = (White-Green/255) / White + Yellow = (White-Blue/255) / White + Black = 1 - White +Note that if the RGB values are all 0, then the CMY values are all 0 and the K value is 1. */ +/* Author - Amit Dutta, Date - 4th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 71, Qn No.: D(b) */ + +#include &lt;stdio.h&gt; + +// declaring function +double get_white(double red, double green, double blue) +{ + double max; + max = red / 255; + if (max &lt; (green / 255)) + max = green / 255; + if (max &lt; (blue / 255)) + max = blue / 255; + return max; +} + +int main() +{ + double r, g, b, w, c = 0, m = 0, y = 0, k = 0; + printf(&quot;Enter the RGB color code in &#x27;R G B&#x27; format : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;r, &amp;g, &amp;b); + + // checking for invalid input (negetive input) + if (r &lt; 0 || g &lt; 0 || b &lt; 0) + { + printf(&quot;\nRGB color code can not be a negetive number.&quot;); + return 1; + } + + // checking for invalid input (out of range color code) + if (r &gt; 255 || g &gt; 255 || b &gt; 255) + { + printf(&quot;\nRGB color code can be maximum (255, 255, 255).&quot;); + return 1; + } + + // converting RGB color code to CMYK color code + if (r == 0 &amp;&amp; g == 0 &amp;&amp; b == 0) + k = 1; + else + { + w = get_white(r, g, b); + c = (w - (r / 255)) / w; + m = (w - (g / 255)) / w; + y = (w - (b / 255)) / w; + k = 1 - w; + } + + printf(&quot;\nRGB color (%g, %g, %g) equivalent to CMYK color (%g, %g, %g, %g).&quot;, r, g, b, c, m, y, k); + return 0; +}</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('luc021.c', 'luc021.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc021.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc021-c', 'luc021.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc021.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc021.c</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/letusc/luc021.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc021.c" 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-letusc-luc021-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A certain grade of steel is graded according to the following conditions: + (i) Hardness must be greater than 50 + (ii) Carbon content must be less than 0.7 + (iii) Tensile strength must be greater than 5600 + +The grades are as follows: + Grade is 10 if all three conditions are met + Grade is 9 if conditions (i) and (ii) are met + Grade is 8 if conditions (ii) and (iii) are met + Grade is 7 if conditions (i) and (iii) are met + Grade is 6 if only one condition is met + Grade is 5 if none of the conditions are met + +Write a program, which will require the user to give values of hardness, +carbon content and tensile strength of the steel under consideration and output +the grade of the steel. */ + +/* Author - Amit Dutta, Date - 4th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 71, Qn No.: D(c) */ + +#include &lt;stdio.h&gt; +int main() +{ + double hardness, carbon_content, tensile_strength; + printf(&quot;Enter the details of the steel below - \n&quot;); + printf(&quot;1. Hardness : &quot;); + scanf(&quot;%lf&quot;, &amp;hardness); + printf(&quot;2. Carbon Content : &quot;); + scanf(&quot;%lf&quot;, &amp;carbon_content); + printf(&quot;3. Tensile Strength : &quot;); + scanf(&quot;%lf&quot;, &amp;tensile_strength); + + // storing how many conditions are met as boolean result + int condition_met, condition1, condition2, condition3; + condition1 = hardness &gt; 50; + condition2 = carbon_content &lt; 0.7; + condition3 = tensile_strength &gt; 5600; + condition_met = condition1 + condition2 + condition3; + + // now grading according the result + int grade; + if (condition_met == 3) + grade = 10; + else if (condition_met == 2) + { + if (condition1 &amp;&amp; condition2) + grade = 9; + else if (condition2 &amp;&amp; condition3) + grade = 8; + else if (condition1 &amp;&amp; condition3) + grade = 7; + } + else if (condition_met == 1) + grade = 6; + else + grade = 5; + + // printing the result + printf(&quot;\n------------- Result -------------&quot;); + printf(&quot;\n1. Hardness : Condition %s&quot;, condition1 ? &quot;MET&quot; : &quot;DID NOT MET&quot;); + printf(&quot;\n2. Carbon Content : Condition %s&quot;, condition2 ? &quot;MET&quot; : &quot;DID NOT MET&quot;); + printf(&quot;\n3. Tensile Strength : Condition %s&quot;, condition3 ? &quot;MET&quot; : &quot;DID NOT MET&quot;); + printf(&quot;\nTotal Condition Met : %d&quot;, condition_met); + printf(&quot;\n\nGrade : %d\n\n&quot;, grade); + return 0; +} + +/* I did not used this long variable names. I used very short just the first letter of the word. +After writting the whole program, I just renamed the valiables. This is possible in Visual Stdio Code. */</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('luc022.c', 'luc022.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc022.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc022-c', 'luc022.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc022.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc022.c</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/letusc/luc022.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc022.c" 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-letusc-luc022-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* The Body Mass Index (BMI) is defined as ratio of weight of the +person (in Kilograms) to square of the height (in meters). +Write a program that receives weight and height, calculate the BMI, and reports +the BMI catagory as per the following table. + BMI Catagory BMI + Starvation &lt; 15 + Anorexic 15.1 to 17.5 + Underweight 17.6 to 18.5 + Ideal 18.6 to 24.9 + Overweight 25 to 25.9 + Obese 30 to 39.9 + Morbidly Obese &gt;= 40 +*/ +/* Author - Amit Dutta, Date - 4th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 72, Qn No.: D(d) */ + +#include &lt;stdio.h&gt; + +int main() +{ + double weight, height, bmi; + printf(&quot;Enter your Weight (in Kilograms) and Height (in Meters) : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;weight, &amp;height); + bmi = weight / (height * height); + printf(&quot;\nCalculated BMI : %g&quot;, bmi); + if (bmi &lt; 15) + printf(&quot;\nBMI Catagory : Starvation&quot;); + else if (bmi &gt;= 15.1 &amp;&amp; bmi &lt;= 17.5) + printf(&quot;\nBMI Catagory : Anorexic&quot;); + else if (bmi &gt;= 17.6 &amp;&amp; bmi &lt;= 18.5) + printf(&quot;\nBMI Catagory : Underweight&quot;); + else if (bmi &gt;= 18.6 &amp;&amp; bmi &lt;= 24.9) + printf(&quot;\nBMI Catagory : Ideal&quot;); + else if (bmi &gt;= 25 &amp;&amp; bmi &lt;= 25.9) + printf(&quot;\nBMI Catagory : Overweight&quot;); + else if (bmi &gt;= 30 &amp;&amp; bmi &lt;= 39.9) + printf(&quot;\nBMI Catagory : Obese&quot;); + else if (bmi &gt;= 40) + printf(&quot;\nBMI Catagory : Morbidly Obese&quot;); + else + printf(&quot;\nBMI Catagory : Unclassified&quot;); + return 0; +}</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('luc023.c', 'luc023.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc023.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc023-c', 'luc023.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc023.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc023.c</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/letusc/luc023.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc023.c" 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-letusc-luc023-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Using conditional operators determine : + (1) Whether the character entered through the keyboard is a + lower case alphabet or not. + (2) Whether a character entered through the keyboard is a special + symbol or not. */ +/* Author - Amit Dutta, Date - 5th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 72, Qn No.: E(a) */ + +#include &lt;stdio.h&gt; +int main() +{ + char inp; + printf(&quot;Enter the character : &quot;); + scanf(&quot;%c&quot;, &amp;inp); + printf(&quot;\nInput Character &#x27;%c&#x27; is %s a LOWER CASE ALPHABET.&quot;, inp, + (inp &gt;= &#x27;a&#x27; &amp;&amp; inp &lt;= &#x27;z&#x27;) ? &quot;&quot; : &quot;NOT&quot;); + printf(&quot;\nInput Character &#x27;%c&#x27; is %s a SPECIAL SYMBOL.&quot;, inp, + (inp &gt;= &#x27;a&#x27; &amp;&amp; inp &lt;= &#x27;z&#x27; || inp &gt;= &#x27;A&#x27; &amp;&amp; inp &lt;= &#x27;Z&#x27; + || inp &gt;= &#x27;0&#x27; &amp;&amp; inp &lt;= &#x27;9&#x27;) ? &quot;NOT&quot; : &quot;&quot;); + return 0; +}</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('luc024.c', 'luc024.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc024.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc024-c', 'luc024.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc024.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc024.c</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/letusc/luc024.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc024.c" 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-letusc-luc024-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program using conditional operators to determine whether +a year entered through the keyboard is a leap year or not. */ +/* Author - Amit Dutta, Date - 5th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 72, Qn No.: E(b) */ + +#include &lt;stdio.h&gt; +int main() +{ + int year; + printf(&quot;Enter the year : &quot;); + scanf(&quot;%d&quot;, &amp;year); + printf(&quot;\nYear %d is %s a Leapyear.&quot;, year, (year % 400 == 0 || year % 4 == 0 &amp;&amp; year % 100 != 0) ? &quot;&quot; : &quot;NOT&quot;); + return 0; +}</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('luc025.c', 'luc025.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc025.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc025-c', 'luc025.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc025.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc025.c</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/letusc/luc025.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc025.c" 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-letusc-luc025-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the greates of the three numbers entered +through the keyboard. Use conditional operators. */ +/* Author - Amit Dutta, Date - 6th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 72, Qn No.: E(c) */ + +#include &lt;stdio.h&gt; +int main() +{ + double num1, num2, num3, max; + printf(&quot;Enter three number : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;num1, &amp;num2, &amp;num3); + printf(&quot;\nGreatest of the three number &#x27;%g&#x27;, &#x27;%g&#x27; and &#x27;%g&#x27; is : &#x27;%g&#x27;&quot;, num1, num2, num3, + (num1 &gt; num2 &amp;&amp; num1 &gt; num3) ? num1 : ((num2 &gt; num1 &amp;&amp; num2 &gt; num3) ? num2 : num3)); + return 0; +}</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('luc026.c', 'luc026.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc026.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc026-c', 'luc026.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc026.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc026.c</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/letusc/luc026.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc026.c" 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-letusc-luc026-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to recieve value of an angle in degreesand check +whether sum of squares of sine and cosine of this angle is equal to 1. */ +/* Author - Amit Dutta, Date - 6th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 73, Qn No.: E(d) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#define EPSILON 0.0000001 + +int main() +{ + double angle, result; + printf(&quot;Enter the angle value in degree : &quot;); + // checking if the input is other than number. + if(scanf(&quot;%lf&quot;, &amp;angle) != 1) { + printf(&quot;\nPlease enter a number.&quot;); + return 1; + } + angle = angle * (M_PI / 180); // converting degree to radian + result = pow(sin(angle), 2) + pow(cos(angle), 2); + (fabs(result - 1.0) &lt; EPSILON) ? + printf(&quot;\nsum of squares of sine and cosine of this angle is equal to 1.&quot;) : + printf(&quot;\nsum of squares of sine and cosine of this angle is NOT equal to 1.&quot;); + return 0; +}</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('luc027.c', 'luc027.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc027.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc027-c', 'luc027.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc027.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc027.c</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/letusc/luc027.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc027.c" 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-letusc-luc027-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Rewrite the folowing program using conditional operations + #include&lt;stdio.h&gt; + int main() + { + float sal; + printf(&quot;Enter the salary&quot;); + scanf(&quot;%f&quot;, &amp;sal); + if(sal &gt;= 25000 &amp;&amp; sal &lt;= 40000) + printf(&quot;Manager\n&quot;); + else + if(sal &gt;= 15000 &amp;&amp; sal &lt; 25000) + printf(&quot;Accountant\n&quot;); + else + printf(&quot;Clerk\n&quot;); + return 0; + } +*/ +/* Author - Amit Dutta, Date - 6th OCT, 2025 */ +/* Let Us C, Chap- 4, Page - 73, Qn No.: E(e) */ + +#include &lt;stdio.h&gt; +int main() +{ + float sal; + printf(&quot;Enter the salary&quot;); + scanf(&quot;%f&quot;, &amp;sal); + (sal &gt;= 25000 &amp;&amp; sal &lt;= 40000) ? printf(&quot;Manager\n&quot;) : + ((sal &gt;= 15000 &amp;&amp; sal &lt; 25000) ? printf(&quot;Accountant\n&quot;) : printf(&quot;Clerk\n&quot;)); + return 0; +}</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('luc028.c', 'luc028.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc028.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc028-c', 'luc028.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc028.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc028.c</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/letusc/luc028.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc028.c" 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-letusc-luc028-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print all the ASCII values and their equivalent +characters using a while loop. The ASCII may vary from 0 to 255. */ +/* Author - Amit Dutta, Date - 7th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(a) */ + +#include &lt;stdio.h&gt; +int main() +{ + int i = 0; + printf(&quot;ASCII Value\tCharacter&quot;); + printf(&quot;\n-----------\t---------\n&quot;); + while (i &lt;= 255) + { + printf(&quot;%d.\t%c\n\n&quot;, i, i); + i++; + } + return 0; +}</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('luc029.c', 'luc029.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc029.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc029-c', 'luc029.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc029.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc029.c</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/letusc/luc029.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc029.c" 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-letusc-luc029-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print out all Armstrong numbers between 100 +and 500. If sum of cubes of each digit of the number is equal to the +number itself, then the number is called an Armstrong number. For +example, 153 = (1 * 1 * 1) + (5 * 5 * 5) + (3 * 3 * 3) */ +/* Author - Amit Dutta, Date - 7th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(b) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + int num = 100, temp1, temp2, res; + printf(&quot;Armstrong numbers between 100 and 500 :&quot;); + while (num &lt;= 500) + { + temp1 = num; + res = 0; + while (temp1 != 0) + { + temp2 = temp1 % 10; + res = res + pow(temp2, 3); + temp1 = temp1 / 10; + } + if (num == res) + printf(&quot; %d&quot;, num); + num++; + } + return 0; +}</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('luc030.c', 'luc030.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc030.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc030-c', 'luc030.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc030.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc030.c</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/letusc/luc030.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc030.c" 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-letusc-luc030-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program for a matchstick game being played between the +computer and a user. Your program should ensure that the computer +always wins. Rules for the game are as follows : + - There are 21 matchsticks. + - The computer asks the player to pick 1, 2, 3, or 4 matchsticks. + - After the person picks, the computer does its picking. + - Whoever is forced to pick up the last matchstick loses the game. +*/ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(c) */ + +/* My Plan: The total number of matchsticks is 21. To guarantee a win, +the computer ensures that after its turn, the number of remaining +matchsticks is always a multiple of 5 plus 1 (i.e., 16, 11, 6, 1). +This is achieved by making the sum of the player&#x27;s pick and the +computer&#x27;s pick equal to 5 in each round. This forces the player +to pick the final matchstick. */ + +#include &lt;stdio.h&gt; +int main() +{ + int remaining_matchsticks = 21, player_pick, computer_pick; + printf(&quot; --- Matchstick Game ---\n&quot;); + printf(&quot;Rules: There are 21 matchsticks. You can pick 1, 2, 3, or 4.\n&quot;); + printf(&quot;Whoever is forced to pick the last matchstick loses the game.\n&quot;); + while (remaining_matchsticks &gt; 1) + { + // game start + printf(&quot;\n--------------------------&quot;); + printf(&quot;\nRemaining Matchsticks : %d&quot;, remaining_matchsticks); + + // player pick and checking input is valid or not + printf(&quot;\nYour turn: Pick 1, 2, 3, or 4 matchsticks: &quot;); + if (scanf(&quot;%d&quot;, &amp;player_pick) != 1) + { + printf(&quot;\n\tPlease enter a number.&quot;); + while (getchar() != &#x27;\n&#x27;) + ; + continue; + } + + // checking player pick is valid or not + if (player_pick &lt; 1 || player_pick &gt; 4) + { + printf(&quot;\n\tPlease enter a number among 1, 2, 3 and 4.&quot;); + while (getchar() != &#x27;\n&#x27;) + ; + continue; + } + + if (player_pick &gt; remaining_matchsticks) + { + printf(&quot;\nInvalid choice! There are not enough matchsticks left.&quot;); + while (getchar() != &#x27;\n&#x27;) + ; + continue; + } + + // computer_picks + computer_pick = 5 - player_pick; + printf(&quot;\ncomputer_picks : %d&quot;, computer_pick); + + // remaining matchsticks + remaining_matchsticks = remaining_matchsticks - (player_pick + computer_pick); + } + + // game over + printf(&quot;\n----------------------------------\n&quot;); + printf(&quot;Only 1 matchstick is left.\n&quot;); + printf(&quot;You are forced to pick the last matchstick. You lose!\n&quot;); + printf(&quot;The computer wins.\n&quot;); + + return 0; +}</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('luc031-logic.c', 'luc031-logic.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc031-logic.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc031-logic-c', 'luc031-logic.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc031-logic.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc031-logic.c</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/letusc/luc031-logic.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031-logic.c" 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-letusc-luc031-logic-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to enter numbers till the user wants. At the end it +should display the count of positive, negative and zeros entered. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(d) */ + +/* + * DETAILED PROGRAM PLAN: + * 1. INITIALIZATION: Set three counters (positive_count, negative_count, zero_count) to zero. + * 2. INPUT LOOP: Start an infinite loop to continuously request user input. + * 3. READ INPUT: Use fgets() to read the user&#x27;s input as a generic string (char array). + * This allows the program to accept multi-digit numbers (e.g., &quot;-500&quot;) or the command (&#x27;n&#x27;). + * 4. TERMINATION CHECK: Immediately check if the input string is exactly &quot;n&quot; using strcmp(). + * If true, the user wants to quit, so break the loop. + * 5. VALIDATION &amp; CONVERSION: If the input is not &quot;n&quot;, use sscanf() to safely attempt to convert + * the string into an integer. + * 6. COUNTING LOGIC: If sscanf() successfully reads an integer (sscanf returns 1): + * - If the number is &gt; 0, increment positive_count. + * - If the number is &lt; 0, increment negative_count. + * - If the number is == 0, increment zero_count. + * 7. ERROR HANDLING: If the input is neither &quot;n&quot; nor a valid number (sscanf returns 0), + * inform the user of invalid input and continue the loop. + * 8. FINAL DISPLAY: After the loop terminates, print the final totals for positive, negative, and zero counts. + */ + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; // for strtol +#include &lt;string.h&gt; // for strcmp + +// Maximum size of the input line +#define MAX_INPUT_LEN 15 + +int main() { + // Initialize counters + int positive_count = 0; + int negative_count = 0; + int zero_count = 0; + + // Buffer to store the user&#x27;s input as a string (e.g., &quot;123&quot;, &quot;-50&quot;, or &quot;n&quot;) + char input_buffer[MAX_INPUT_LEN]; + int number; + + printf(&quot;--- Number Analyzer ---\n&quot;); + printf(&quot;Enter numbers one by one. Type &#x27;n&#x27; and press Enter to finish.\n\n&quot;); + + // Loop until the user enters &#x27;n&#x27; + while (1) { + printf(&quot;Enter number or &#x27;n&#x27;: &quot;); + + // Read the entire line of input into the buffer + if (fgets(input_buffer, MAX_INPUT_LEN, stdin) == NULL) { + // Handle EOF (end of file) or reading error + break; + } + + // Remove the trailing newline character from the input_buffer + // The last character will be &#x27;\n&#x27; if the input was shorter than MAX_INPUT_LEN + size_t len = strlen(input_buffer); + if (len &gt; 0 &amp;&amp; input_buffer[len - 1] == &#x27;\n&#x27;) { + input_buffer[len - 1] = &#x27;\0&#x27;; + } + + // 1. Check for the termination condition + if (strcmp(input_buffer, &quot;n&quot;) == 0) { + printf(&quot;\n&#x27;n&#x27; received. Stopping input...\n&quot;); + break; // Exit the while loop + } + + // 2. Attempt to convert the input string to an integer + // sscanf attempts to read the string according to the format &quot;%d&quot; (decimal integer) + // It returns 1 if a number was successfully read. + int conversions = sscanf(input_buffer, &quot;%d&quot;, &amp;number); + + if (conversions == 1) { + // Conversion was successful, now check the number&#x27;s sign + if (number &gt; 0) { + positive_count++; + } else if (number &lt; 0) { + negative_count++; + } else { + zero_count++; + } + printf(&quot; -&gt; Number recorded: %d\n&quot;, number); + } else { + // Conversion failed. The input was neither &#x27;n&#x27; nor a valid integer. + printf(&quot; -&gt; Invalid input. Please enter a valid number or &#x27;n&#x27;.\n&quot;); + } + } + + // Display the final results + printf(&quot;\n====================================\n&quot;); + printf(&quot; Analysis Complete\n&quot;); + printf(&quot;====================================\n&quot;); + printf(&quot;Positive numbers entered: %d\n&quot;, positive_count); + printf(&quot;Negative numbers entered: %d\n&quot;, negative_count); + printf(&quot;Zeroes entered: %d\n&quot;, zero_count); + printf(&quot;Total numbers recorded: %d\n&quot;, positive_count + negative_count + zero_count); + printf(&quot;====================================\n&quot;); + + return 0; +}</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('luc031.c', 'luc031.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc031.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc031-c', 'luc031.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc031.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc031.c</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/letusc/luc031.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031.c" 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-letusc-luc031-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to enter numbers till the user wants. At the end it +should display the count of positive, negative and zeros entered. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(d) */ + +#include &lt;stdio.h&gt; +int main() +{ + int choice = 1, num, positive_count = 0, negative_count = 0, zero_count = 0; + while (choice == 1) + { + printf(&quot;\nEnter the number (Type any character and press Enter to finish.) : &quot;); + choice = scanf(&quot;%d&quot;, &amp;num); // Checking whether the user has input any characters + if (choice == 1) + { + printf(&quot;Number recorded : %d&quot;, num); + if (num &lt; 0) + negative_count++; + else if (num &gt; 0) + positive_count++; + else if (num == 0) + zero_count++; + } + else + { + // If the user inputs any characters, then choice = 0, it means he doesn&#x27;t want to give any more input; + choice = 0; + printf(&quot;\nCharacter received. Stopping input...\n&quot;); + } + } + // Display the final results + printf(&quot;\n====================================\n&quot;); + printf(&quot; Analysis Complete\n&quot;); + printf(&quot;====================================\n&quot;); + printf(&quot;Positive numbers entered: %d\n&quot;, positive_count); + printf(&quot;Negative numbers entered: %d\n&quot;, negative_count); + printf(&quot;Zeroes entered: %d\n&quot;, zero_count); + printf(&quot;Total numbers recorded: %d\n&quot;, positive_count + negative_count + zero_count); + printf(&quot;====================================\n&quot;); +}</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('luc032.c', 'luc032.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc032.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc032-c', 'luc032.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc032.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc032.c</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/letusc/luc032.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc032.c" 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-letusc-luc032-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to recieve an integer and find its octal equivalent. +(Hint : To obtain octal equivalent of an integer, Divide it continuously +by 8 till dividend does not become zero, then write the remainders +obtained in reverse derection.) */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(e) */ + +// using array + +#include &lt;stdio.h&gt; +int main() +{ + int octal[20], decimal, index = 0, temp, rem; + printf(&quot;Enter the decimal number : &quot;); + scanf(&quot;%d&quot;, &amp;decimal); + temp = decimal; + while (temp != 0) + { + rem = temp % 8; + temp = temp / 8; + octal[index] = rem; + index++; + } + printf(&quot;\nDeciaml %d to octal : &quot;, decimal); + while ((index - 1) &gt;= 0) + { + printf(&quot;%d&quot;, octal[index - 1]); + index--; + } + return 0; +}</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('luc033.c', 'luc033.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc033.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc033-c', 'luc033.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc033.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc033.c</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/letusc/luc033.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc033.c" 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-letusc-luc033-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the range of a set of numbers entered +through the keyboard. Range is the difference between the smallest +and biggest number in the list. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +/* Let Us C, Chap- 5, Page - 87, Qn No.: B(f) */ + +#include &lt;stdio.h&gt; +int main() +{ + int choice = 1, set_of_numbers[30], num, index = -1; + while (choice == 1) + { + printf(&quot;\nEnter the number (Type any character and press Enter to finish.) : &quot;); + choice = scanf(&quot;%d&quot;, &amp;num); // Checking whether the user has input any characters + if (choice != 1) + { + // If the user inputs any characters, then choice = 0, it means he doesn&#x27;t want to give any more input; + choice = 0; + printf(&quot;\nCharacter received. Stopping input...\n&quot;); + break; + } + index++; + set_of_numbers[index] = num; + } + int max = set_of_numbers[0], min = set_of_numbers[0]; + while (index &gt;= 0) + { + if (max &lt; set_of_numbers[index]) + max = set_of_numbers[index]; + if (min &gt; set_of_numbers[index]) + min = set_of_numbers[index]; + index--; + } + int range = max - min; + printf(&quot;\nBiggest number in the set : %d&quot;, max); + printf(&quot;\nSmallest number in the set : %d&quot;, min); + printf(&quot;\nRange : %d&quot;, range); + return 0; +}</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('luc034.c', 'luc034.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc034.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc034-c', 'luc034.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc034.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc034.c</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/letusc/luc034.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc034.c" 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-letusc-luc034-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print the multiplication table of the number +entered by the user. The table should get displayed in the following +form : + 29 * 1 = 29 + 29 * 2 = 58 +*/ +/* Author - Amit Dutta, Date - 20th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 105, Qn No.: B(a) */ + +#include &lt;stdio.h&gt; +int main() +{ + int i, num, res; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + printf(&quot;\n--- Multiplication Table ---\n&quot;); + for (i = 1; i &lt;= 10; i++) + printf(&quot;%d * %d = %d\n&quot;, num, i, num * i); + return 0; +}</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('luc035.c', 'luc035.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc035.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc035-c', 'luc035.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc035.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc035.c</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/letusc/luc035.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc035.c" 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-letusc-luc035-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* According to a study, the approximate level of intelligence of a +person can be calculated using the following formula. + i = 2 + (y + 0.5x) +write a program that will produce a table of values of i, y and x, +where y varies from 1 to 6, and, for each value of y, x varies from +5.5 to 12.5 in steps of 0.5 */ +/* Author - Amit Dutta, Date - 20th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 105, Qn No.: B(b) */ + +#include &lt;stdio.h&gt; +int main() +{ + double y, x; + printf(&quot;\n--- Approximate Intelligence ---\n&quot;); + for (y = 1; y &lt;= 6; y++) + { + printf(&quot;\tY = %d\n&quot;, y); + for (x = 5.5; x &lt;= 12.5; x += 0.5) + { + printf(&quot;Y: %g\t X: %.2g\t I: %g\n&quot;, y, x, 2 + (y + 0.5 * x)); + } + printf(&quot;-----------------------\n&quot;); + } + return 0; +}</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('luc036.c', 'luc036.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc036.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc036-c', 'luc036.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc036.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc036.c</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/letusc/luc036.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc036.c" 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-letusc-luc036-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* When interest compounds q times per year at an annual rate of +r % for n years, the principle p compounds to an amount a as per +the following formula + a = p (1 + r / q) ^ nq +Write a program to read 10 sets of p, r, n &amp; q and calculate the +corresponding as&#x27; */ +/* Author - Amit Dutta, Date - 20th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(c) */ + +// DEVELOPMENT STATUS: This implementation is currently untested. +// Please report any functional defects or errors by submitting a GitHub issue &quot;https://github.com/notamitgamer/bsc/issues&quot; with the updated code. + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double interest, principalAmount, interestRate, timeInYears, compoundFactor, totalAmount; + int index; + for (index = 1; index &lt;= 10; index++) + { + printf(&quot;Enter Principle amount : &quot;); + scanf(&quot;%lf&quot;, &amp;principalAmount); + printf(&quot;Enter Rate of Interest : &quot;); + scanf(&quot;%lf&quot;, &amp;interestRate); + interestRate *= 0.01; + printf(&quot;Enter the Time (Years) : &quot;); + scanf(&quot;%lf&quot;, &amp;timeInYears); + printf(&quot;Compound count in one year : &quot;); + scanf(&quot;%lf&quot;, &amp;compoundFactor); + totalAmount = (principalAmount * pow((1 + interestRate / compoundFactor), (timeInYears * compoundFactor))); + interest = totalAmount - principalAmount; + printf(&quot;\nInterest : %.2f\nTotal Amount : %.2f\n\n&quot;, interest, totalAmount); + } + return 0; +}</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('luc037.c', 'luc037.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc037.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc037-c', 'luc037.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc037.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc037.c</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/letusc/luc037.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc037.c" 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-letusc-luc037-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* The natural logarithm can be approximated by the following series. + (x-1)/x + 1/2 ((x-1)/x)^2 + 1/2 ((x-1)/x)^3 + 1/2 ((x-1)/x)^4 + ... +If x is input through the keyboard, write a program to calculate the +sum of the first seven terms of this series. */ +/* Author - Amit Dutta, Date - 21st OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(d) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +double series(double x) // made this fn only for fun, making a fn was not necessary +{ + double result = (x - 1) / x; + int i; + for (i = 2; i &lt;= 7; i++) + { + result += 0.5 * pow(((x - 1) / x), i); + } + return result; +} + +int main() +{ + double x; + printf(&quot;Enter the value for x : &quot;); + scanf(&quot;%lf&quot;, &amp;x); + printf(&quot;\nResult : %g&quot;, series(x)); + return 0; +}</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('luc038.c', 'luc038.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc038.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc038-c', 'luc038.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc038.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc038.c</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/letusc/luc038.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc038.c" 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-letusc-luc038-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to generate all Pythagorean Triplets with slide +length less than or equal to 30. */ +/* Author - Amit Dutta, Date - 21st OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(e) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int a, b, c; + printf(&quot;Pythagorean Triplets with slide length less than or equal to 30 : \n&quot;); + for (a = 1; a &lt;= 30; a++) + { + for (b = a; b &lt;= 30; b++) + { + int c_square = a * a + b * b; + for (c = b + 1; c &lt;= 30; c++) + { + if (c * c == c_square) + printf(&quot;(%d, %d, %d)\n&quot;, a, b, c); + } + } + } + return 0; +}</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('luc039.c', 'luc039.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc039.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc039-c', 'luc039.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc039.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc039.c</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/letusc/luc039.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc039.c" 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-letusc-luc039-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Population of a town today is 100000. The population has increased +steadily at the rate of 10% per year for last 10 years. Write a +program to determine the population at the end of each year in the +last decade. */ +/* Author - Amit Dutta, Date - 21st OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(f) */ + +#include &lt;stdio.h&gt; +int main() +{ + int i, population = 100000; + printf(&quot;Present year : %d\n&quot;, population); + for (i = 1; i &lt;= 10; i++) + { + population /= 1.10; + printf(&quot;%d year ago : %d\n&quot;, i, population); + } + return 0; +}</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('luc040-logic.c', 'luc040-logic.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc040-logic.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc040-logic-c', 'luc040-logic.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc040-logic.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc040-logic.c</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/letusc/luc040-logic.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc040-logic.c" 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-letusc-luc040-logic-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Ramanujan number (1729) is the smallest number that can be +expressed as sum of cubes in two different ways - 1729 can be +expressed as 1^3 + 12^3 and 9^3 + 10^3. Write a program to print all such +numbers up to a reasonable limit. */ +/* Author - Amit Dutta, Date - 22nd - 23rd OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(g) */ + +// 1. INCLUDE SECTION +#include &lt;stdio.h&gt; // Includes the standard input/output library, necessary for printf() + +// 2. CONSTANT DEFINITIONS (MACROS) +// These define fixed values we can easily use and change later. +#define LIMIT 100000 // The maximum number we want to search up to. +// The maximum base value (a, b, c, or d) we need to check. +// Since 47^3 is greater than 100,000, checking bases up to 47 covers the LIMIT. +#define MAX_BASE_VAL 47 + +// 3. MAIN FUNCTION +int main() +{ + // 4. VARIABLE DECLARATION + + // sum1 and sum2 store the results of a^3 + b^3 and c^3 + d^3. + // We use &#x27;long long&#x27; because cubes (like 47^3) are large and can exceed + // the capacity of a standard &#x27;int&#x27;, preventing errors. + long long sum1, sum2; + + int count = 0; // Counter to keep track of how many Ramanujan numbers we find. + + // This flag is used to optimize the search. If we find the second way (c^3 + d^3) + // to make sum1, we set this to 1 and immediately stop the inner loops. + int found_match; + + // Print introductory message to the user. + printf(&quot;Ramanujan Number Finder (a^3 + b^3 = c^3 + d^3)\n&quot;); + printf(&quot;Searching up to %d (Max base value is %d)\n&quot;, LIMIT, MAX_BASE_VAL); + printf(&quot;---------------------------------------------------\n&quot;); + + // 5. OUTER LOOPS: Establishing the FIRST SUM (a^3 + b^3 = sum1) + + // Loop for &#x27;a&#x27; (the smaller base of the first pair) + for (int a = 1; a &lt;= MAX_BASE_VAL; a++) + { + + // Loop for &#x27;b&#x27; (the larger base of the first pair) + // We start &#x27;b&#x27; at &#x27;a + 1&#x27; to enforce the rule a &lt; b. + // This prevents us from checking redundant pairs like (1, 12) and (12, 1). + for (int b = a + 1; b &lt;= MAX_BASE_VAL; b++) + { + + // Calculate the first sum: sum1 = a^3 + b^3 + // (long long) is a cast to ensure the math is done using the &#x27;long long&#x27; type. + sum1 = (long long)a * a * a + (long long)b * b * b; + + // Optimization 1: Check if the sum exceeds the global limit. + if (sum1 &gt; LIMIT) + { + // Since &#x27;b&#x27; is increasing, any further increase will also be over the limit. + // We stop the &#x27;b&#x27; loop and move to the next &#x27;a&#x27;. + break; + } + + // Reset the flag for every new sum1. + // We start searching for a second way for this new &#x27;sum1&#x27;, so we reset the flag to 0. + found_match = 0; + + // 6. INNER LOOPS: Searching for the SECOND SUM (c^3 + d^3 = sum2) + + // Loop for &#x27;c&#x27; (the smaller base of the second pair) + // We start &#x27;c&#x27; at &#x27;a + 1&#x27; to enforce the rule a &lt; c. + // This ensures the two pairs {(a, b) and (c, d)} are truly distinct (e.g., 1729 = 1^3 + 12^3 and 9^3 + 10^3). + for (int c = a + 1; c &lt;= MAX_BASE_VAL; c++) + { + + // Optimization 2: Check the flag to exit the &#x27;c&#x27; loop early. + if (found_match) + { + // If we already found the second way (c, d) in a previous iteration of &#x27;c&#x27;, stop searching and move to the next (a, b) pair. + break; + } + + // Loop for &#x27;d&#x27; (the larger base of the second pair) + // We start &#x27;d&#x27; at &#x27;c + 1&#x27; to enforce c &lt; d. + for (int d = c + 1; d &lt;= MAX_BASE_VAL; d++) + { + + // Calculate the second sum: sum2 = c^3 + d^3 + sum2 = (long long)c * c * c + (long long)d * d * d; + + // Optimization 3: Check if the second sum has passed the first sum. + if (sum2 &gt; sum1) + { + // Since &#x27;d&#x27; is increasing, any further increase will also be greater than sum1. + // We stop the &#x27;d&#x27; loop and move to the next &#x27;c&#x27;. + break; + } + + // 7. CONDITION CHECK: Have we found a Ramanujan number? + // Check if the two sums are equal. + if (sum1 == sum2) + { + count++; // Increment the counter + + // Print the result in the required format. + printf(&quot;[%d] %lld = %d^3 + %d^3 = %d^3 + %d^3\n&quot;, + count, sum1, a, b, c, d); + + // Set the flag to 1, confirming we found the second way. + found_match = 1; + + // Stop the &#x27;d&#x27; loop immediately, as we found the required second pair. + break; + } + } + // If found_match was set to 1, the &#x27;break&#x27; in the d loop will execute, + // then the &#x27;if (found_match) break;&#x27; in the c loop will execute, + // and the program will move to the next (a, b) pair. + } + } + } + + // 8. CONCLUSION + printf(&quot;---------------------------------------------------\n&quot;); + printf(&quot;Search complete. Found %d Ramanujan-type numbers.\n&quot;, count); + + return 0; // Standard way to indicate successful program execution. +} +</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('luc040.c', 'luc040.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc040.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc040-c', 'luc040.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc040.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc040.c</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/letusc/luc040.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc040.c" 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-letusc-luc040-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Ramanujan number (1729) is the smallest number that can be +expressed as sum of cubes in two different ways - 1729 can be +expressed as 1^3 + 12^3 and 9^3 + 10^3. Write a program to print all such +numbers up to a reasonable limit. */ +/* Author - Amit Dutta, Date - 22nd - 23rd OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(g) */ + +#include &lt;stdio.h&gt; + +#define limit 100000 +#define max_base 47 + +int main() +{ + + long long sum1, sum2; + int count = 0; + + printf(&quot;Ramanujan numbers : \n&quot;); + + int found_match; + + for (int a = 1; a &lt;= max_base; a++) + { + for (int b = a + 1; b &lt;= max_base; b++) + { + sum1 = (long long)a * a * a + (long long)b * b * b; + if (sum1 &gt; limit) + { + break; + } + + found_match = 0; + + for (int c = a + 1; c &lt;= max_base; c++) + { + if (found_match) + { + break; + } + for (int d = c + 1; d &lt;= max_base; d++) + { + sum2 = (long long)c * c * c + (long long)d * d * d; + if (sum2 &gt; sum1) + { + break; + } + if (sum1 == sum2) + { + count++; + printf(&quot;(%d.) %lld = %d^3 + %d^3 = %d^3 + %d^3\n&quot;, count, sum1, a, b, c, d); + + found_match = 1; + break; + } + } + } + } + } + + printf(&quot;-------------------------------\n&quot;); + printf(&quot;Search complete.&quot;); + + return 0; +}</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('luc041.c', 'luc041.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc041.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc041-c', 'luc041.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc041.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc041.c</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/letusc/luc041.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc041.c" 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-letusc-luc041-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print 24 hours of day with suitable suffixes like +AM, PM, Noon and Midnight. */ +/* Author - Amit Dutta, Date - 23rd OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(h) */ + +#include &lt;stdio.h&gt; +int main() +{ + int hour, temp; + printf(&quot;Time \tSuffix\n&quot;); + for (int hour = 0; hour &lt;= 23; hour++) + { + if (hour == 0) + printf(&quot;12:00\tAM (Midnight)\n&quot;); + else if (hour == 12) + printf(&quot;12:00\tPM (Noon)\n&quot;); + else if (hour &gt;= 1 &amp;&amp; hour &lt;= 11) + printf(&quot;%02d:00\tAM\n&quot;, hour); + else if (hour &gt;= 13 &amp;&amp; hour &lt;= 23) + printf(&quot;%02d:00\tPM\n&quot;, hour - 12); + } + return 0; +}</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('luc042.c', 'luc042.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc042.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc042-c', 'luc042.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc042.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc042.c</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/letusc/luc042.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc042.c" 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-letusc-luc042-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to produce the following output : + 1 + 2 3 + 4 5 6 +7 8 9 10 +*/ + +/* Author - Amit Dutta, Date - 23rd OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(i) */ + +#include &lt;stdio.h&gt; +int main() +{ + int starter = 1; + int tab = 3; + printf(&quot;The pattern : \n&quot;); + for (int i = 1; i &lt;= 4; i++) + { + int count = 0; + for (int k = 1; k &lt;= tab; k++) + { + printf(&quot; &quot;); + } + tab = tab - 1; + for (int j = starter; j &lt;= 10; j++) + { + if (count &gt;= i) + { + break; + } + printf(&quot;%d &quot;, j); + count++; + starter++; + } + printf(&quot;\n&quot;); + } + return 0; +}</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('luc043.c', 'luc043.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc043.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc043-c', 'luc043.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc043.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc043.c</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/letusc/luc043.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc043.c" 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-letusc-luc043-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the grace marks for a student using switch. +The user should enter the class obtained by the student and the +number of subjects he has failed in. Use the following logic. + - If the student gets first class and he fails in more than 3 + subjects, he does not get any grace, Otherwise, he gets a grace + of 5 marks per subject. + - If the student gets second class and he fails in more than 2 + subjects, he does not get any grace. Otherwise, he gets a grace + of 4 marks per subject. + - If the student gets third class and he fails in more than 1 + subject, then he does not get any grace. Otherwise, he gets a + grace of 5 marks. +*/ +/* Author - Amit Dutta, Date - 28th OCT, 2025 */ +/* Let Us C, Chap- 7, Page - 125, Qn No.: C */ + +#include &lt;stdio.h&gt; + +int main() +{ + int studentClass, failedSubjectCount, graceMarks = 0; + printf(&quot;Class obtained by the student (Enter 1 for First Class, 2 for Second Class, 3 for Third Class): &quot;); + scanf(&quot;%d&quot;, &amp;studentClass); + printf(&quot;Failed Subject Count: &quot;); + scanf(&quot;%d&quot;, &amp;failedSubjectCount); + + if (failedSubjectCount &lt; 0) { + printf(&quot;\nFailed subject count cannot be negative.&quot;); + return 1; + } + + switch (studentClass) + { + case 1: + if (failedSubjectCount &lt;= 3) + { + graceMarks += 5 * failedSubjectCount; + } + break; + + case 2: + if (failedSubjectCount &lt;= 2) + { + graceMarks += 4 * failedSubjectCount; + } + break; + + case 3: + if (failedSubjectCount &lt;= 1) + { + graceMarks += 5 * failedSubjectCount; + } + break; + + default: + printf(&quot;\nWrong Choice.&quot;); + return 1; + } + + printf(&quot;\nStudent will get %d grace marks.&quot;, graceMarks); + return 0; +}</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('luc044.c', 'luc044.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc044.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc044-c', 'luc044.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc044.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc044.c</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/letusc/luc044.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc044.c" 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-letusc-luc044-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Any year is entered through the keyboard. Write a function to +determine whether the year is aleap year or not. */ +/* Author - Amit Dutta, Date - 17th November, 2025 */ +/* Let Us C, Chap- 8, Page - 144, Qn No.: C(1) */ + +#include &lt;stdio.h&gt; + +int leapYear(int); + +int leapYear(int year) +{ + if ((year % 400 == 0) || ((year % 4 == 0) &amp;&amp; (year % 100 != 0))) + return 1; + else + return 0; +} + +int main() +{ + int year; + printf(&quot;Enter the year : &quot;); + scanf(&quot;%d&quot;, &amp;year); + if (leapYear(year)) + printf(&quot;\nYear %d is a Leap Year.&quot;, year); + else + printf(&quot;\nYear %d is not a Leap Year.&quot;, year); + return 0; +}</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('luc045.c', 'luc045.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc045.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc045-c', 'luc045.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc045.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc045.c</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/letusc/luc045.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc045.c" 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-letusc-luc045-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A position integer is entered through the keyboard. Write a Function +to obtain the prime factors of this number. +For example, prime factors of 24 are 2, 2, 2 and 3, whereas prime +factors of 35 are 5 and 7 +*/ +/* Author - Amit Dutta, Date - 17th November, 2025 */ +/* Let Us C, Chap- 8, Page - 144, Qn No.: C(2) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +void findPrimeFactors(int n) +{ + int temp_n = n; + + if (temp_n == 1) + { + printf(&quot;Prime factors of %d are: None.\n&quot;, n); + return; + } + + printf(&quot;Prime factors of %d are:&quot;, n); + + while (temp_n % 2 == 0) + { + printf(&quot; %d&quot;, 2); + temp_n = temp_n / 2; + } + + for (int i = 3; i &lt;= (int)sqrt(temp_n); i = i + 2) + { + while (temp_n % i == 0) + { + printf(&quot; %d&quot;, i); + temp_n = temp_n / i; + } + } + + if (temp_n &gt; 2) + { + printf(&quot; %d&quot;, temp_n); + } + + printf(&quot;\n&quot;); +} + +int main() +{ + int n; + printf(&quot;Enter a positive integer to get the prime factors: &quot;); + if (scanf(&quot;%d&quot;, &amp;n) != 1) + { + printf(&quot;Error: Invalid input. Please enter an integer.\n&quot;); + return 1; + } + if (n &lt;= 0) + { + printf(&quot;Error: Please enter a POSITIVE integer.\n&quot;); + return 1; + } + findPrimeFactors(n); + return 0; +}</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('luc046.c', 'luc046.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc046.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc046-c', 'luc046.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc046.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc046.c</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/letusc/luc046.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc046.c" 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-letusc-luc046-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Given three variables x, y, z, write a function to circularly shift their +values to right. In other words, if x = 5, y = 8, z = 10, after circular +shift y = 5, z = 8, x = 10. cal the function with variables a, b, c to +circularly shift values. +*/ +/* Author - Amit Dutta, Date - 24th November, 2025 */ +/* Let Us C, Chap- 9, Page - 163, Qn No.: C(a) */ + +#include &lt;stdio.h&gt; + +void circularShift(int *, int *, int *); + +int main() +{ + int x = 5, y = 8, z = 10; + + printf(&quot;--- Before Shift ---\n&quot;); + printf(&quot;x: %d, y: %d, z: %d&quot;, x, y, z); + + circularShift(&amp;x, &amp;y, &amp;z); + + printf(&quot;\n--- After Shift ---\n&quot;); + printf(&quot;x: %d, y: %d, z: %d&quot;, x, y, z); + + return 0; +} + +void circularShift(int *x, int *y, int *z) +{ + int temp = *z; + *z = *y; + *y = *x; + *x = temp; +}</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('luc047.c', 'luc047.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc047.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc047-c', 'luc047.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc047.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc047.c</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/letusc/luc047.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc047.c" 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-letusc-luc047-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Define a function that receives weight of a commodity in kilograms +and returns the equivalent weight in Grams, Tons and pounds. Call +this fuction from main() and print the results in main() +*/ +/* Author - Amit Dutta, Date - 24th November, 2025 */ +/* Let Us C, Chap- 9, Page - 163, Qn No.: C(b) */ + +#include &lt;stdio.h&gt; + +void convertWeight(double, double *, double *, double *); + +int main() +{ + double weightGram, weightPound, weightKG, weightTON; + printf(&quot;Enter the weight of the comodity in Kilogram(s): &quot;); + scanf(&quot;%lf&quot;, &amp;weightKG); + + convertWeight(weightKG, &amp;weightGram, &amp;weightPound, &amp;weightTON); + printf(&quot;\n%g Kilogram(s) = %.04f Gram(s)&quot; + &quot;\n%g Kilogram(s) = %.04f Pound(s)&quot; + &quot;\n%g Kilogram(s) = %.04f TON(s)&quot;, + weightKG, weightGram, weightKG, weightPound, weightKG, weightTON); + return 0; +} + +void convertWeight(double weightKG, double *weightGram, double *weightPound, double *weightTON) +{ + *weightGram = weightKG * 1000.0; + *weightPound = weightKG * 2.2046226218; + *weightTON = weightKG / 1000.0; +}</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('luc048.c', 'luc048.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/luc048.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-luc048-c', 'luc048.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/luc048.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc048.c</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/letusc/luc048.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc048.c" 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-letusc-luc048-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Define a function to compute the distance between two points and +use it to develop another function that will compute the area of the +triangle whose vertices are A(x1, y1), B(x2, y2), and C(x3, y3). Use +these functions to develop a function which returns a value 1 if the +point (x, y) lines inside the triangle ABC, otherwise returns a value +0. Would you get any advantage if you develop these functions to +work on call by reference principle? +*/ +/* Author - Amit Dutta, Date - 25th November, 2025 */ +/* Let Us C, Chap- 9 (Pointers), Page - 163, Qn No.: C(c) */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;ctype.h&gt; +#include &lt;stdlib.h&gt; + +void distance(double, double, double, double, double *); +void area(double, double, double, double, double, double, double *); +int is_inside(double, double, double, double, double, double, double, double); + +int main() +{ + + // Variables + double x, y, x1, x2, y1, y2, x3, y3, result_Distance, result_Area; + char choice; + + /* ********** Requirement: 1 ********** */ + + // Calculate the length of the line segment between two points, P1(x1, y1) and P2(x2, y2). + // Function Used: distance() + + printf(&quot;--- Compute the distance between two points ---\n\n&quot;); + printf(&quot;Enter the co-ordinates of Point 1 (Ex.: 5,6): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x1, &amp;y1); + printf(&quot;Enter the co-ordinates of Point 2 (Ex.: 3,4): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x2, &amp;y2); + + distance(x1, y1, x2, y2, &amp;result_Distance); + printf(&quot;\nDistance between P1(%g, %g) and P2(%g, %g) = %g&quot;, + x1, y1, x2, y2, result_Distance); + + /* ********** Requirement: 2 ********** */ + + // Calculate the area of a triangle ABC using its three vertices A(x1, y1), B(x2, y2), and C(x3, y3). + // Fuction Used: distance(), area() + + printf(&quot;\n\n--- Compute the area of a triangle ABC ---\n\n&quot;); + printf(&quot;Enter the co-ordinates of Point A (Ex.: 5,6): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x1, &amp;y1); + printf(&quot;Enter the co-ordinates of Point B (Ex.: 3,4): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x2, &amp;y2); + printf(&quot;Enter the co-ordinates of Point C (Ex.: 6,7): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x3, &amp;y3); + + area(x1, y1, x2, y2, x3, y3, &amp;result_Area); + printf(&quot;\nArea of the A(%g, %g), B(%g, %g), C(%g, %g) = %g&quot;, + x1, y1, x2, y2, x3, y3, result_Area); + + /* ********** Requirement: 3 ********** */ + + // Check if a test point P(x, y) lies strictly inside the triangle ABC. + // Function Used: distance(), area(), is_inside() + + printf(&quot;\n\n--- Check if a test point P(x, y) lies strictly inside the triangle ABC ---\n\n&quot;); + printf(&quot;Do you wish to use previous entered triangle?&quot; + &quot;\nIf Yes, type &#x27;Y&#x27;; If No, type &#x27;N&#x27;: &quot;); + scanf(&quot; %c&quot;, &amp;choice); + choice = toupper(choice); + switch (choice) + { + case &#x27;Y&#x27;: + break; + case &#x27;N&#x27;: + printf(&quot;Enter the co-ordinates of Point A (Ex.: 5,6): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x1, &amp;y1); + printf(&quot;Enter the co-ordinates of Point B (Ex.: 3,4): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x2, &amp;y2); + printf(&quot;Enter the co-ordinates of Point C (Ex.: 6,7): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x3, &amp;y3); + break; + default: + printf(&quot;\nYou entered invalid choice.&quot;); + break; + } + printf(&quot;Enter the co-ordinates of Test Point (Ex.: 3,5): &quot;); + scanf(&quot;%lf,%lf&quot;, &amp;x, &amp;y); + + if (is_inside(x, y, x1, y1, x2, y2, x3, y3)) + printf(&quot;\nTest Point (%g, %g) is inside ABC.&quot;, x, y); + else + printf(&quot;\nTest Point (%g, %g) is not inside ABC.&quot;, x, y); + + /* ANSWER TO THE QUESTION: + Qn.: + Would you get any advantage if you develop these functions to + work on call by reference principle? + + Ans: + NO, there is no advantage, and moreover, that would be a disadvantage. + It introduces unnecessary dereferencing overhead for every operation, + Which is less efficient than reading the simple value copy supplied by Call by Value. + */ + + // End of Program + return 0; +} + +void distance(double x1, double y1, double x2, double y2, double *result_Distance) +{ + *result_Distance = sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)); +} + +void area(double x1, double y1, double x2, double y2, double x3, double y3, double *result_Area) +{ + double s, ab, bc, ac; + + distance(x1, y1, x2, y2, &amp;ab); + distance(x2, y2, x3, y3, &amp;bc); + distance(x1, y1, x3, y3, &amp;ac); + + s = (ab + bc + ac) / 2.0; + double area_sq = s * (s - ab) * (s - bc) * (s - ac); + + if (area_sq &lt; 0) + // Handle cases where area_sq is slightly negative due to floating-point errors + *result_Area = 0.0; + else + *result_Area = sqrt(area_sq); +} + +int is_inside(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3) +{ + double area_ABC, area_PAB, area_PBC, area_PAC; + + const double EPSILON = 0.000001; + + area(x1, y1, x2, y2, x3, y3, &amp;area_ABC); + area(x, y, x1, y1, x2, y2, &amp;area_PAB); + area(x, y, x2, y2, x3, y3, &amp;area_PBC); + area(x, y, x1, y1, x3, y3, &amp;area_PAC); + + double sum_of_sub_areas = area_PAB + area_PBC + area_PAC; + + if (fabs(area_ABC - sum_of_sub_areas) &lt; EPSILON) + return 1; + else + return 0; +} + +/* + *************** SAMPLE OUTPUT *************** + +PS G:\bsc\letusc&gt; ./*.exe +--- Compute the distance between two points --- + +Enter the co-ordinates of Point 1 (Ex.: 5,6): 1234.56,7890.12 +Enter the co-ordinates of Point 2 (Ex.: 3,4): 1234.56,7891.12 + +Distance between P1(1234.56, 7890.12) and P2(1234.56, 7891.12) = 1 + +--- Compute the area of a triangle ABC --- + +Enter the co-ordinates of Point A (Ex.: 5,6): 100.10,200.20 +Enter the co-ordinates of Point B (Ex.: 3,4): 105.10,200.20 +Enter the co-ordinates of Point C (Ex.: 6,7): 100.10,205.20 + +Area of the A(100.1, 200.2), B(105.1, 200.2), C(100.1, 205.2) = 12.5 + +--- Check if a test point P(x, y) lies strictly inside the triangle ABC --- + +Do you wish to use previous entered triangle? +If Yes, type &#x27;Y&#x27;; If No, type &#x27;N&#x27;: y +Enter the co-ordinates of Test Point (Ex.: 3,5): 101.10,201.20 + +Test Point (101.1, 201.2) is inside ABC. + +*/</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('lucproblem001.c', 'lucproblem001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem001-c', 'lucproblem001.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem001.c</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/letusc/lucproblem001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.c" 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-letusc-lucproblem001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Consider a currency system in which there are notes of six denominations, +namely, Rs. 1, Rs. 2, rs. 5, Rs. 10, Rs. 50, Rs. 100. If a sum +of Rs. N is entered through the keyboard, Write a program to compute +the smallest number of notes that will combine to give Rs. N. */ +/* Author - Amit Dutta, Date - 29th SEP, 2025 */ +/* Let Us C, Chap - 2, Page - 22, Problem 2.3 */ + +#include &lt;stdio.h&gt; +int main() +{ + int n, nonotes, temp; + printf(&quot;Enter the amount : &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (n &lt; 1) + { + printf(&quot;\nAmount should be a positive integer.&quot;); + return 1; + } + temp = n; + nonotes = n / 100; + n = n % 100; + nonotes = nonotes + (n / 50); + n = n % 50; + nonotes = nonotes + (n / 10); + n = n % 10; + nonotes = nonotes + (n / 5); + n = n % 5; + nonotes = nonotes + (n / 2); + n = n % 2; + nonotes = nonotes + n; + printf(&quot;\nthe smallest number of notes that will combine to give Rs. %d : %d&quot;, temp, nonotes); + return 0; +}</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('lucproblem002.c', 'lucproblem002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem002-c', 'lucproblem002.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem002.c</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/letusc/lucproblem002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem002.c" 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-letusc-lucproblem002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A year is entered through the keyboard, write a program to +determine whether the year is leap or not. Use the logical operators +&amp;&amp; and || . */ +/* Author - Amit Dutta, Date - 02th OCT, 2025 */ +/* Let Us C, Chap - 4, Page - 64, Problem 4.1 */ + +#include &lt;stdio.h&gt; +int main() +{ + int year; + printf(&quot;Enter year : &quot;); + scanf(&quot;%d&quot;, &amp;year); + if (year % 4 == 0 &amp;&amp; year &amp; 100 != 0 || year % 400 == 0) + printf(&quot;\nYear %d is a leapyear.&quot;, year); + else + printf(&quot;\nYear %d is not a leapyear.&quot;, year); + return 0; +}</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('lucproblem003.c', 'lucproblem003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem003-c', 'lucproblem003.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem003.c</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/letusc/lucproblem003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem003.c" 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-letusc-lucproblem003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* If a character is entered through the keyboard, Write a program +to determine whether the character is a capital letter, a small case letter, +a digit or a speacial symbol. +The following table shows the range of ASCII values for various characters : + Characters ASCII Values + A - Z 65 - 90 + a - z 97 - 122 + 0 - 9 48 - 57 + special symbols 0 - 47, 58 - 64, 91 - 96, 123 - 127 +*/ +/* Author - Amit Dutta, Date - 02th OCT, 2025 */ +/* Let Us C, Chap - 4, Page - 65, Problem 4.2 */ + +#include &lt;stdio.h&gt; +int main() +{ + char inp; + printf(&quot;Enter one character : &quot;); + scanf(&quot; %c&quot;, &amp;inp); + if (inp &gt;= 64 &amp;&amp; inp &lt;= 90) + printf(&quot;\nInput &#x27;%c&#x27; is a CAPITAL LETTER.&quot;, inp); + if (inp &gt;= 97 &amp;&amp; inp &lt;= 122) + printf(&quot;\nInput &#x27;%c&#x27; is a SMALL CASE LETTER.&quot;, inp); + if (inp &gt;= 48 &amp;&amp; inp &lt;= 57) + printf(&quot;\nInput &#x27;%c&#x27; is a DIGIT.&quot;, inp); + if (inp &gt;= 0 &amp;&amp; inp &lt;= 47 || inp &gt;= 58 &amp;&amp; inp &lt;= 64 + || inp &gt;= 91 &amp;&amp; inp &lt;= 96 || inp &gt;= 123 &amp;&amp; inp &lt;= 127) + printf(&quot;\nInput &#x27;%c&#x27; is a SPECIAL SYMBOL.&quot;, inp); + return 0; +}</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('lucproblem004.c', 'lucproblem004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem004-c', 'lucproblem004.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem004.c</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/letusc/lucproblem004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem004.c" 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-letusc-lucproblem004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* If the lengths of three sides of a triangle are entered through the +keyboard, write a program to check whether the triangle is valid or not. +The triangle is valid if the sum of two sides is greater that the largest +of the three sides. */ +/* Author - Amit Dutta, Date - 02th OCT, 2025 */ +/* Let Us C, Chap - 4, Page - 66, Problem 4.3 */ + +#include &lt;stdio.h&gt; +int main() +{ + double side1, side2, side3; + printf(&quot;Enter the length of side1, side2 and side3 of the triangle : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;side1, &amp;side2, &amp;side3); + if (side1 &lt;= 0 || side2 &lt;= 0 || side3 &lt;= 0) + { + printf(&quot;\nTriangle sides must be positive.\n&quot;); + return 1; + } + if ((side1 + side2 &gt; side3) &amp;&amp; (side1 + side3 &gt; side2) &amp;&amp; (side2 + side3 &gt; side1)) + // Triangle Inequality Theorem + printf(&quot;\nThis triangle is valid.&quot;); + else + printf(&quot;\nThis triangle is not valid.&quot;); + return 0; +}</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('lucproblem005.c', 'lucproblem005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem005-c', 'lucproblem005.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem005.c</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/letusc/lucproblem005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem005.c" 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-letusc-lucproblem005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to calculate overtime pay of 10 employees. Overtime is +paid at the rate of Rs. 120.00 per hour for every hour worked above 40 +hours. Assume that employees do not work for fractional part of an hour. */ +/* ONLY WHILE LOOP ALLOWED */ +/* Author - Amit Dutta, Date - 07th OCT, 2025 */ +/* Let Us C, Chap - 5, Page - 83, Problem 5.1 */ + +#include &lt;stdio.h&gt; +#include &lt;conio.h&gt; +int main() +{ + int working_hour, i = 1; + double pay; + while (i &lt;= 10) + { + printf(&quot;Enter the working hour for the employee no. %d : &quot;, i); + if (scanf(&quot;%d&quot;, &amp;working_hour) != 1) + { + printf(&quot;\n\tPlease enter a number as woking hour.\n\n&quot;); + while (getchar() != &#x27;\n&#x27;) + ; + // above line discard the input characters untill getchar() reaches the new line character. + /* if I do not discard the input, after &#x27;continue;&#x27; statement that input will be again taken + by scanf (In the line 17). It will be a infinite loop of error. */ + continue; + } + // checking overtime + if (working_hour &gt; 40) + { + pay = (working_hour - 40) * 120.00; + printf(&quot;\n\tOvertime working hours of Employee %d : %d&quot;, i, (working_hour - 40)); + printf(&quot;\n\tPay of the overtime for Employee %d : Rs. %.2f\n\n&quot;, i, pay); + } + else + printf(&quot;\n\tEmployee %d did not work any overtime.\n\n&quot;, i); + i++; // changing to next employee + } +}</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('lucproblem006.c', 'lucproblem006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem006-c', 'lucproblem006.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem006.c</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/letusc/lucproblem006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem006.c" 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-letusc-lucproblem006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the factorial value of any number entered +through the keyboard. */ +/* Author - Amit Dutta, Date - 07th OCT, 2025 */ +/* Let Us C, Chap - 5, Page - 84, Problem 5.2 */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, i = 1; + long long fact = 1; + printf(&quot;Enter the number : &quot;); + // checking if the input is valid or not + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + return 1; + } + // result for the negetive input + if (num &lt; 0) + { + printf(&quot;\nFactorial of %d : Undefined&quot;, num); + return 1; + } + // Hard codded result for input &#x27;0&#x27; (zero) + if (num == 0) + { + printf(&quot;\nFactorial of 0 : 1&quot;); + return 0; + } + // calculating result + while (i &lt;= num) { + fact = fact * i; + i++; + } + printf(&quot;\nFactorial of %d : %d&quot;, num, fact); + return 0; +}</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('lucproblem007.c', 'lucproblem007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem007-c', 'lucproblem007.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem007.c</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/letusc/lucproblem007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem007.c" 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-letusc-lucproblem007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Two numbers are entered through the keyboard. Write a program to +find the value of one number raised to the power of another */ +/* Author - Amit Dutta, Date - 07th OCT, 2025 */ +/* Let Us C, Chap - 5, Page - 84, Problem 5.3 */ + +#include &lt;stdio.h&gt; +int main() +{ + double num, result; + int power, i = 1; + printf(&quot;Enter the numbers in &#x27;num^power&#x27; format : &quot;); + // checking if the input is valid or not + if (scanf(&quot;%lf^%d&quot;, &amp;num, &amp;power) != 2) + { + printf(&quot;\nPlease enter numbers.&quot;); + return 1; + } + // result for the negetive input + if (power &lt; 0) + { + printf(&quot;\nPlease use a positive number as power.&quot;); + return 1; + } + // Hard codded result for input &#x27;0&#x27; (zero) + if (power == 0) + { + printf(&quot;\n%g to the power of %d is : 1&quot;, num, power); + return 0; + } + result = num; + while (i &lt;= power - 1) + { + result = result * num; + i++; + } + printf(&quot;\n%g to the power of %d is : %g&quot;, num, power, result); + return 0; +}</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('lucproblem008.c', 'lucproblem008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem008-c', 'lucproblem008.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem008.c</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/letusc/lucproblem008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem008.c" 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-letusc-lucproblem008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a problem to print all the prime numbers from 1 to 300. */ +/* Author - Amit Dutta, Date - 24th OCT, 2025 */ +/* Let Us C, Chap - 6, Page - 101, Problem 6.1 */ + +// Method: Trial Division (Optimized to check up to sqrt(N)) + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdbool.h&gt; + +#define LIMIT 300 + +int main() +{ + printf(&quot;Prime numbers from 1 to 300 : 2&quot;); // as 2 is the only even prime number + for (int i = 3; i &lt;= LIMIT; i += 2) // skipping all other even number + { + int n = (int)sqrt(i); + bool prime = true; + + for (int j = 3; j &lt;= n; j += 2) + // an odd number is only devisable by another odd number. + // so, skipping even number. + { + if (i % j == 0) + { + prime = false; + break; + } + } + if (prime) + { + printf(&quot; %d&quot;, i); + } + } + return 0; +}</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('lucproblem009.c', 'lucproblem009.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem009.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem009-c', 'lucproblem009.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem009.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem009.c</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/letusc/lucproblem009.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem009.c" 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-letusc-lucproblem009-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to add first seven terms of the following series using a +for loop. + 1 / 1! + 2 / 2! + 3 / 3! + ... +*/ +/* Author - Amit Dutta, Date - 24th OCT, 2025 */ +/* Let Us C, Chap - 6, Page - 102, Problem 6.2 */ + +#include &lt;stdio.h&gt; +#define N 7 // update N here + +int main() +{ + double sum = 0; int fact = 1; + for (int i = 1; i &lt;= N; i++) + { + fact *= i; + sum += (double)i / fact; + } + printf(&quot;Sum of the series : %g&quot;, sum); + return 0; +}</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('lucproblem010-complex.c', 'lucproblem010-complex.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem010-complex.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem010-complex-c', 'lucproblem010-complex.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem010-complex.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem010-complex.c</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/letusc/lucproblem010-complex.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem010-complex.c" 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-letusc-lucproblem010-complex-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to generate all combinations (permutations) of 1, 2 and 3 + from 1-digit numbers up to 4-digit numbers using a main loop to control + the number of digits (1 to 3333). +*/ +/* Author - Amit Dutta, Date - 24th OCT, 2025 */ +/* Let Us C, Chap - 6, Page - 103, Problem 6.3 */ + +#include &lt;stdio.h&gt; + +// --- RECURSIVE FUNCTION TO ACHIEVE DYNAMIC NESTING --- +// current_digit: The digit being placed in the current position (1, 2, or 3) +// target_length: The total length of the number we are building (e.g., 3 for 3-digit numbers) +// current_number: The integer value built so far +// current_length: How many digits have been placed so far +void generate_combinations(int target_length, int current_number, int current_length) +{ + + // Base Case 1: The number is complete. Print it and return. + if (current_length == target_length) + { + printf(&quot; %d&quot;, current_number); + return; + } + + // Recursive Step: Try placing the next digit (1, 2, or 3) + // The for loop now iterates through the *possible values* for the next digit. + for (int next_digit = 1; next_digit &lt;= 3; next_digit++) + { + + // Build the new number: old_number * 10 + next_digit + int new_number = current_number * 10 + next_digit; + + // Recurse: Try to place the next digit + generate_combinations(target_length, new_number, current_length + 1); + } +} + +int main() +{ + printf(&quot;Combination of 1, 2 and 3 (1-digit up to 4-digits):\n&quot;); + + /* This outer loop achieves the structure you were going for: + iterating through the required number of digits (1, 2, 3, 4). + */ + for (int noOfDigits = 1; noOfDigits &lt;= 4; noOfDigits++) + { + printf(&quot;\n\n--- %d-DIGIT NUMBERS (%d total) ---\n&quot;, noOfDigits, (1 &lt;&lt; noOfDigits) * 3 / 4 * 4 / 3 * 3 * 3 / 9 * 3 + (noOfDigits == 1 ? 0 : 9) + (noOfDigits == 2 ? 0 : 9) + (noOfDigits == 3 ? 0 : 81) + (noOfDigits == 4 ? 0 : 0) + (noOfDigits == 1 ? 3 : 0) + (noOfDigits == 2 ? 9 : 0) + (noOfDigits == 3 ? 27 : 0) + (noOfDigits == 4 ? 81 : 0)); // Prints the count 3, 9, 27, or 81 + + // Start the recursive generation for the current length + generate_combinations(noOfDigits, 0, 0); + } + + printf(&quot;\n\nTotal permutations generated: 120\n&quot;); + + return 0; +} +</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('lucproblem010.c', 'lucproblem010.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem010.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem010-c', 'lucproblem010.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem010.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem010.c</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/letusc/lucproblem010.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem010.c" 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-letusc-lucproblem010-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to generate all combination of 1, 2 and 3 using for loop. */ +/* Author - Amit Dutta, Date - 24th OCT, 2025 */ +/* Let Us C, Chap - 6, Page - 103, Problem 6.3 */ + +#include &lt;stdio.h&gt; + +int main() +{ + printf(&quot;Combination of 1, 2 and 3 :&quot;); + + // for 1 digit numbers + for (int i = 1; i &lt;= 3; i++) + { + printf(&quot; %d&quot;, i); + } + + // for 2 digit numbers + for (int i = 1; i &lt;= 3; i++) + { + for (int j = 1; j &lt;= 3; j++) + { + printf(&quot; %d%d&quot;, i, j); + } + } + + // for 3 digit numbers + for (int i = 1; i &lt;= 3; i++) + { + for (int j = 1; j &lt;= 3; j++) + { + for (int k = 1; k &lt;= 3; k++) + { + printf(&quot; %d%d%d&quot;, i, j, k); + } + } + } + + // for 4 digit numbers + for (int i = 1; i &lt;= 3; i++) + { + for (int j = 1; j &lt;= 3; j++) + { + for (int k = 1; k &lt;= 3; k++) + { + for (int l = 1; l &lt;= 3; l++) + { + printf(&quot; %d%d%d%d&quot;, i, j, k, l); + } + } + } + } + + return 0; +}</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('lucproblem011.c', 'lucproblem011.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem011.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem011-c', 'lucproblem011.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem011.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem011.c</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/letusc/lucproblem011.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem011.c" 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-letusc-lucproblem011-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a menu driven program which has following options : + 1. Factorial of a number + 2. Prime or not + 3. Odd or even + 4. Exit +Once a menu item is selected the appropriate action should be taken +and once this action is finished, the menu should reappear. Unless +the user selects the &#x27;Exit&#x27; option the program should continue work. +*/ +/* Author - Amit Dutta, Date - 26th OCT, 2025 */ +/* Let Us C, Chap - 7, Page - 118, Problem 7.1 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;stdbool.h&gt; + +// Function to clear the input buffer after scanf to prevent issues in the next input. +void clearInputBuffer() +{ + int c; + while ((c = getchar()) != &#x27;\n&#x27; &amp;&amp; c != EOF) + ; +} + +// Calculates the factorial of the input number. +void factorial(int num) +{ + // Factorial is not defined for negative numbers. + if (num &lt; 0) + { + printf(&quot;\nFactorial is not defined for negative numbers.&quot;); + return; + } + // Checks for input over 20 to prevent long long integer overflow (20! is max safe). + if (num &gt; 20) + { + printf(&quot;\nFactorial of %d is too large to calculate (max safe integer factorial is 20!).&quot;, num); + return; + } + long long fact = 1; + // Calculate factorial iteratively. + for (int i = 1; i &lt;= num; i++) + { + fact *= i; + } + printf(&quot;\nFactorial of %d = %lld&quot;, num, fact); + return; +} + +// Checks if the input number is a prime number. +void prime(int num) +{ + // Handle special cases: 1 and 2. + if (num == 1) + { + printf(&quot;\nInput 1 is NOT a PRIME NUMBER.&quot;); + return; + } + else if (num == 2) + { + printf(&quot;\nInput 2 is a PRIME NUMBER. (Fact : 2 is only even prime number)&quot;); + return; + } + // Exclude all other even numbers. + if (num % 2 == 0) + { + printf(&quot;\nInput %d is NOT a PRIME NUMBER.&quot;, num); + return; + } + // Optimization: Only check divisors up to the square root of num. + int endCheckDigit = sqrt(num); + bool isPrime = true; + // Check only odd divisors (i += 2) starting from 3. + for (int i = 3; i &lt;= endCheckDigit; i += 2) + { + if (num % i == 0) + { + printf(&quot;\nInput %d is NOT a PRIME NUMBER.&quot;, num); + isPrime = false; + break; + } + } + if (isPrime) + { + printf(&quot;\nInput %d is a PRIME NUMBER.&quot;, num); + return; + } +} + +// Checks if the input number is odd or even. +void oddoreven(int num) +{ + // A number is even if it is perfectly divisible by 2. + if (num % 2 == 0) + { + printf(&quot;\nInput %d is a EVEN NUMBER.&quot;, num); + return; + } + else + { + printf(&quot;\nInput %d is a ODD NUMBER.&quot;, num); + return; + } +} + +// Main function: displays the menu and controls program flow. +int main() +{ + int choice, num; + // Infinite loop ensures the menu reappears after every operation until &#x27;Exit&#x27; is chosen. + while (1) + { + // Display menu options. + printf(&quot;\n\n===== MENU =====&quot; + &quot;\n1. Factorial of a number&quot; + &quot;\n2. Prime or not&quot; + &quot;\n3. Odd or Even&quot; + &quot;\n4. Exit&quot;); + printf(&quot;\nEnter your choice : &quot;); + + // Input validation for menu choice. + if (scanf(&quot;%d&quot;, &amp;choice) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + clearInputBuffer(); + continue; + } + clearInputBuffer(); + + // Handle menu selection using switch-case. + switch (choice) + { + case 1: + printf(&quot;\n=== FACTORIAL OF A NUMBER ===&quot;); + printf(&quot;\nEnter the number : &quot;); + // Input validation for the number to be factored. + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + clearInputBuffer(); + continue; + } + clearInputBuffer(); + factorial(num); + break; + case 2: + printf(&quot;\n=== PRIME OR NOT ===&quot;); + printf(&quot;\nEnter the number : &quot;); + // Input validation for the number to be checked. + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + clearInputBuffer(); + continue; + } + clearInputBuffer(); + // Require a non-negative, non-zero number for prime check. + if (num &lt; 0) + { + printf(&quot;\nPlease enter a postive number.&quot;); + continue; + } + else if (num == 0) + { + printf(&quot;\nPlease enter a non-zero number.&quot;); + continue; + } + prime(num); + break; + case 3: + printf(&quot;\n=== ODD OR EVEN ===&quot;); + printf(&quot;\nEnter the number : &quot;); + // Input validation for the number to be checked. + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + clearInputBuffer(); + continue; + } + clearInputBuffer(); + oddoreven(num); + break; + case 4: + // Exit the program cleanly. + printf(&quot;\nExiting the program.\n\nSAYONARA...\n\n&quot;); + exit(0); + default: + // Handle invalid menu choice input. + printf(&quot;\nPlease enter a valid choice.&quot;); + break; + } + } +}</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('lucproblem012.c', 'lucproblem012.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem012.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem012-c', 'lucproblem012.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem012.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem012.c</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/letusc/lucproblem012.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem012.c" 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-letusc-lucproblem012-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a Function power(a, b), to calculate the value of a raised to b */ +/* Author - Amit Dutta, Date - 17th November, 2025 */ +/* Let Us C, Chap - 8, Page - 141, Problem 8.2 */ + +#include &lt;stdio.h&gt; + +double power(double, int); + +double power(double a, int b) +{ + if (b == 0) + return 1; + double res = 1; + int i; + if (b &gt; 0) + for (i = 1; i &lt;= b; i++) + res *= a; + return res; +} + +int main() +{ + double a, result; + int b; + printf(&quot;Enter the value and the power (Format A^B) : &quot;); + scanf(&quot;%lf^%d&quot;, &amp;a, &amp;b); + result = power(a, b); + printf(&quot;Result of %g^%d = %g&quot;, a, b, result); + return 0; +}</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('lucproblem013.c', 'lucproblem013.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem013.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem013-c', 'lucproblem013.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem013.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem013.c</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/letusc/lucproblem013.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem013.c" 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-letusc-lucproblem013-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Define a function to convert any given year into its Roman equivalent. +Use these roman equivalent for decimal numbers : 1 - I, 5 - V, 10 - X, +50 - L, 100 - C, 500 - D, 1000 - M */ +/* Author - Amit Dutta, Date - 17th November, 2025 */ +/* Let Us C, Chap - 8, Page - 141, Problem 8.3 */ + +#include &lt;stdio.h&gt; + +void romanise(int); + +void romanise(int year) +{ + int values[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; + const char *romanChar[] = {&quot;M&quot;, &quot;CM&quot;, &quot;D&quot;, &quot;CD&quot;, &quot;C&quot;, &quot;XC&quot;, &quot;L&quot;, &quot;XL&quot;, &quot;X&quot;, &quot;IX&quot;, &quot;V&quot;, &quot;IV&quot;, &quot;I&quot;}; + // including the two-character subtractive pairs. + int i = 0; + + printf(&quot;Year %d = &quot;, year); + while (year &gt; 0) + { + if (year &gt;= values[i]) + { + printf(&quot;%s&quot;, romanChar[i]); + year -= values[i]; + } + else + i++; + } +} + +int main() +{ + int year; + printf(&quot;Enter the year : &quot;); + scanf(&quot;%d&quot;, &amp;year); + romanise(year); + return 0; +}</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('lucproblem014-short.c', 'lucproblem014-short.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem014-short.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem014-short-c', 'lucproblem014-short.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem014-short.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem014-short.c</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/letusc/lucproblem014-short.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem014-short.c" 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-letusc-lucproblem014-short-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a function that receives integers and returns the sum, average +and standard deviation of these numbers. Call this function from main() +and print the result in main() */ +/* Author - Amit Dutta, Date - 23th November, 2025 */ +/* Let Us C, Chap - 9, Page 159, Problem 9.1 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +void stats(double *, double *, double *); + +int main() +{ + double sum, average, standardDeviation; + stats(&amp;sum, &amp;average, &amp;standardDeviation); + + printf(&quot;\n--- Stats ---&quot; + &quot;\nSum: %g&quot; + &quot;\nAverage: %g&quot; + &quot;\nStandard Deviation: %g&quot;, + sum, average, standardDeviation); + return 0; +} + +void stats(double *sum, double *average, double *standardDeviation) +{ + int n; + printf(&quot;How many numbers you want to give input: &quot;); + scanf(&quot;%d&quot;, &amp;n); + + double inputNumber[n]; + int i; + + printf(&quot;\n--- Enter Numbers ---\n&quot;); + for (i = 0; i &lt; n; i++) + { + printf(&quot;Enter number %d: &quot;, i + 1); + scanf(&quot;%lf&quot;, &amp;inputNumber[i]); + } + + double tempSum = 0; + for (i = 0; i &lt; n; i++) + tempSum += inputNumber[i]; + + double tempAverage = tempSum / n; + + double tempStandardDeviation = 0.0; + + if (n &gt; 1) + { + double tempSumation = 0; + for (i = 0; i &lt; n; i++) + tempSumation += pow((inputNumber[i] - tempAverage), 2.0); + + tempStandardDeviation = sqrt(tempSumation / (n - 1)); + } + + *sum = tempSum; + *average = tempAverage; + *standardDeviation = tempStandardDeviation; +}</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('lucproblem014.c', 'lucproblem014.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem014.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem014-c', 'lucproblem014.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem014.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem014.c</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/letusc/lucproblem014.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem014.c" 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-letusc-lucproblem014-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a function that receives integers and returns the sum, average +and standard deviation of these numbers. Call this function from main() +and print the result in main() */ +/* Author - Amit Dutta, Date - 23th November, 2025 */ +/* Let Us C, Chap - 9, Page 158, Problem 9.1 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +// Function prototype: Using pointers for &#x27;call by reference&#x27; to return 3 values. +void stats(double *, double *, double *); + +int main() +{ + double sum, average, standardDeviation; + // Passing addresses of variables to receive results from the function. + stats(&amp;sum, &amp;average, &amp;standardDeviation); + + printf(&quot;\n--- Stats ---&quot; + &quot;\nSum: %g&quot; + &quot;\nAverage: %g&quot; + &quot;\nStandard Deviation: %g&quot;, + sum, average, standardDeviation); + return 0; +} + +// Function to calculate statistics on user-provided numbers. +void stats(double *sum, double *average, double *standardDeviation) +{ + int n; + // Input Validation Loop for N + do + { + printf(&quot;How many numbers you want to give input: &quot;); + + if (scanf(&quot;%d&quot;, &amp;n) == 1) + { + break; + } + else + { + printf(&quot;\nPlease enter a valid number.\n&quot;); + // Clearing input buffer to handle invalid input + while (getchar() != &#x27;\n&#x27; &amp;&amp; !feof(stdin)) + ; + } + } while (1); + + // Variable-Length Array (VLA) to store the input numbers. + double inputNumber[n]; + int i = 0; + + printf(&quot;\n--- Enter Numbers ---\n&quot;); + + // Input Loop for numbers + while (i &lt; n) + { + printf(&quot;Enter number %d: &quot;, i + 1); + + if (scanf(&quot;%lf&quot;, &amp;inputNumber[i]) == 1) + { + // Clearing input buffer after successful read + while (getchar() != &#x27;\n&#x27;) + ; + i++; + } + else + { + printf(&quot;Invalid input. Only integers are allowed. Please try again.\n&quot;); + // Clearing input buffer to handle invalid input + while (getchar() != &#x27;\n&#x27; &amp;&amp; !feof(stdin)) + ; + } + } + + // 1. Sum Calculation + double tempSum = 0; + for (i = 0; i &lt; n; i++) + tempSum += inputNumber[i]; + + // 2. Average (Mean) calculation + double tempAverage = tempSum / n; + + // 3. Standard Deviation (Sample SD formula used) + double tempStandardDeviation = 0.0; + + // Preventing division by zero if n is 1. SD is 0 for a single number. + if (n &gt; 1) + { + double tempSumation = 0; + // calculating the sum of squared differences from the mean + for (i = 0; i &lt; n; i++) + tempSumation += pow((inputNumber[i] - tempAverage), 2.0); + + // Calculating sample standard deviation + tempStandardDeviation = sqrt(tempSumation / (n - 1)); + } + + // Assigning final values back to the variables in main(). + *sum = tempSum; + *average = tempAverage; + *standardDeviation = tempStandardDeviation; +}</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('lucproblem015.c', 'lucproblem015.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem015.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem015-c', 'lucproblem015.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem015.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem015.c</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/letusc/lucproblem015.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem015.c" 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-letusc-lucproblem015-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program that defines a function that calculates power of one +number reaised to another and factorial value of a number in one cell. */ +/* Author - Amit Dutta, Date - 24th November, 2025 */ +/* Let Us C, Chap - 9, Page 159, Problem 9.2 */ + +#include &lt;stdio.h&gt; + +void bothPowerFactorial(double, int, int, double *, long long *); + +int main() +{ + double a, resultPower; + int b, factN; + long long resultFactorial; + printf(&quot;Enter a and b for calculating a raised to b: &quot;); + scanf(&quot;%lf %d&quot;, &amp;a, &amp;b); + printf(&quot;Enter number to calculate the factorial: &quot;); + scanf(&quot;%d&quot;, &amp;factN); + if (b &lt; 0 || factN &lt; 0) + { + printf(&quot;\nOnly non-negative integer is allowed as input of b and factorial.&quot;); + return 1; + } + bothPowerFactorial(a, b, factN, &amp;resultPower, &amp;resultFactorial); + printf(&quot;\n%g Raised to %d: %g&quot; + &quot;\nFactorial of %d: %lld&quot;, + a, b, resultPower, factN, resultFactorial); + return 0; +} + +void bothPowerFactorial(double a, int b, int n, double *resultPower, long long *resultFactorial) +{ + double tempResultPower = 1; + long long tempResultFactorial = 1; + int i; + + for (i = 1; i &lt;= b; i++) + tempResultPower *= a; + + for (i = 1; i &lt;= n; i++) + tempResultFactorial *= i; + + *resultPower = tempResultPower; + *resultFactorial = tempResultFactorial; +}</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('lucproblem016.c', 'lucproblem016.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/letusc/lucproblem016.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-letusc-lucproblem016-c', 'lucproblem016.c', 'https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem016.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">lucproblem016.c</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/letusc/lucproblem016.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem016.c" 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-letusc-lucproblem016-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Figure 9.4 shows three memory locations and values stored in them. +Write a program to declare variables that implement the relationship +shown. How will you print the values and addresses shown in the figure? +On which machine the program should be executed to get such addresses? + +Figure 9.4: + value: 3.14, memory_address: 7fff9489c79c + value: 7fff9489c7a0, memory_address: 7fff4fd134b8 + value: 7fff9489c79c, memory_address: 7fff9489c7a0 +*/ +/* Author - Amit Dutta, Date - 24th November, 2025 */ +/* Let Us C, Chap - 9, Page 160, Problem 9.3 */ + +#include &lt;stdio.h&gt; + +int main() +{ + float a = 3.14; + float *c = &amp;a; + float **b = &amp;c; + + printf(&quot;Location 1 (Variable a):\n&quot;); + printf(&quot;Value: %g\n&quot;, a); + printf(&quot;Address: %p\n&quot;, (void *)&amp;a); + printf(&quot;------------------------------\n&quot;); + + printf(&quot;Location 3 (Variable c: float *):\n&quot;); + printf(&quot;Value (Address stored): %p\n&quot;, (void *)c); + printf(&quot;Address of c itself: %p\n&quot;, (void *)&amp;c); + printf(&quot;Value pointed to (*c): %g\n&quot;, *c); + printf(&quot;------------------------------\n&quot;); + + printf(&quot;Location 2 (Variable b: float **):\n&quot;); + printf(&quot;Value (Address stored): %p\n&quot;, (void *)b); + printf(&quot;Address of b itself: %p\n&quot;, (void *)&amp;b); + printf(&quot;Value pointed to (*b): %p\n&quot;, (void *)*b); + printf(&quot;Value pointed to (**b): %g\n&quot;, **b); + printf(&quot;------------------------------\n&quot;); + + return 0; +}</div> </div> </div> @@ -1626,171 +9337,987 @@ <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('pc001.c', 'pc001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc001-c', 'pc001.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc001.c</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/practice-c/pc001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc001.c" 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-practice-c-pc001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Pattern : + 1 + 1 2 + 1 2 3 + 1 2 3 4 + 1 2 3 4 5 +for n = 5 +*/ +/* Author - Amit Dutta, Date - 02nd October, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int i, j, num; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;num); + for (i = 1; i &lt;= num; i++) + { + for (j = 1; j &lt;= i; j++) + { + printf(&quot;%d\t&quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +}</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('pc002.c', 'pc002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc002-c', 'pc002.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc002.c</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/practice-c/pc002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc002.c" 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-practice-c-pc002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Pattern : + 1 2 3 4 5 + 6 7 8 9 + 10 11 12 + 13 14 + 15 +for n = 5 +*/ + +/* Author - Amit Dutta, Date - 02nd NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int i, j, n, temp = 1; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = n; i &gt;= 1; i--) + { + for (j = 1; j &lt;= i; j++) + { + printf(&quot;%d\t&quot;, temp); + temp++; + } + printf(&quot;\n&quot;); + } + return 0; +}</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('pc003.c', 'pc003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc003-c', 'pc003.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc003.c</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/practice-c/pc003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc003.c" 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-practice-c-pc003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Pattern : + 1 + 2 4 + 3 6 9 + 4 8 12 16 + 5 10 15 20 25 +for n = 5 +*/ + +#include &lt;stdio.h&gt; +int main() +{ + int i, j, n; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + for (j = 1; j &lt;= i; j++) + { + printf(&quot;%d\t&quot;, i * j); + } + printf(&quot;\n&quot;); + } + return 0; +}</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('pc004.c', 'pc004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc004-c', 'pc004.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc004.c</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/practice-c/pc004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc004.c" 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-practice-c-pc004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Pattern : + 5 4 3 2 1 + 4 3 2 1 + 3 2 1 + 2 1 + 1 +for n = 5 +*/ + +#include &lt;stdio.h&gt; +int main() +{ + int i, j, k, n; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = n; i &gt;= 1; i--) + { + for (j = 1; j &lt;= i - 1; j++) + { + printf(&quot;\t&quot;); + } + for (k = i; k &gt;= 1; k--) + { + printf(&quot;%d\t&quot;, k); + } + printf(&quot;\n&quot;); + } + return 0; +}</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('pc005.c', 'pc005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc005-c', 'pc005.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc005.c</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/practice-c/pc005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc005.c" 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-practice-c-pc005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Pattern : + 1 + 1 2 + 3 5 8 + 13 21 34 55 + 89 144 233 377 610 +for n = 5 +*/ + +#include &lt;stdio.h&gt; +int main() +{ + int i, j, n; + long long temp1 = 0, temp2 = 1, temp3; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + printf(&quot;1\n&quot;); + for (i = 2; i &lt;= n; i++) + { + for (j = 1; j &lt;= i; j++) + { + temp3 = temp1 + temp2; + printf(&quot;%lld\t&quot;, temp3); + temp1 = temp2; + temp2 = temp3; + } + printf(&quot;\n&quot;); + } + return 0; +}</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('pc006.c', 'pc006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc006-c', 'pc006.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc006.c</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/practice-c/pc006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc006.c" 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-practice-c-pc006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Prime number check */ +/* Author - Amit Dutta, Date - 03rd NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num, i, temp; + printf(&quot;Enter the number : &quot;); + if(scanf(&quot;%d&quot;, &amp;num) != 1) { + printf(&quot;Only postive number allowed.&quot;); + return 1; + } + if(num &lt;= 0) { + printf(&quot;\nOnly potive number are allowed.&quot;); + return 1; + } + if(num == 1) { + printf(&quot;\nInput 1 is not a prime number.&quot;); + return 0; + } + if(num == 2) { + printf(&quot;\nInput 2 is a prime number.&quot;); + return 0; + } + if(num % 2 == 0) { + printf(&quot;\nInput %d is not a prime number.&quot;, num); + return 0; + } + temp = (int)sqrt(num); + for (i = 3; i &lt;= temp; i += 2) + { + if (num % i == 0) + { + printf(&quot;\nInput %d is not a prime number.&quot;, num); + return 0; + } + } + printf(&quot;\nInput %d is a prime number.&quot;, num); + return 0; +}</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('pc007.c', 'pc007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc007-c', 'pc007.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc007.c</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/practice-c/pc007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc007.c" 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-practice-c-pc007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Armstrong number check only for three digit */ +/* Author - Amit Dutta, Date - 03rd NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int num, temp1, armstrongCheck = 0; + printf(&quot;Enter a three digit number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nOnly positive number allowed.&quot;); + return 1; + } + if (num &lt; 100 || num &gt; 999) + { + printf(&quot;\nOnly Three digit postive number allowed.&quot;); + return 1; + } + temp1 = num; + while (temp1 &gt; 0) + { + armstrongCheck += (temp1 % 10) * (temp1 % 10) * (temp1 % 10); + temp1 /= 10; + } + if (armstrongCheck == num) + printf(&quot;\nInput %d is a armstrong number.&quot;, num); + else + printf(&quot;\nInput %d is not a armstrong number.&quot;, num); + return 0; +}</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('pc008.c', 'pc008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc008-c', 'pc008.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc008.c</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/practice-c/pc008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc008.c" 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-practice-c-pc008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Factorial upto N */ +/* Author - Amit Dutta, Date - 03rd November, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int n, i; + long long fact = 1; + printf(&quot;Enter n : &quot;); + if (scanf(&quot;%d&quot;, &amp;n) != 1) + { + printf(&quot;\nOnly non-negative number allowed.&quot;); + return 1; + } + if (n &lt; 0) + { + printf(&quot;\nOnly non-negative number allowed.&quot;); + return 1; + } + if (n == 0) + { + printf(&quot;\nFactorial of 0 : 1&quot;); + return 0; + } + for (i = 1; i &lt;= n; i++) + fact *= i; + printf(&quot;\nFactorial of %d : %lld&quot;, n, fact); + return 0; +}</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('pc009.c', 'pc009.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc009.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc009-c', 'pc009.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc009.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc009.c</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/practice-c/pc009.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc009.c" 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-practice-c-pc009-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Sum of digit */ +/* Author - Amit Dutta, Date - 04th November, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, sumOfDigit = 0, temp; + printf(&quot;Enter the number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nOnly a number is allowed.&quot;); + return 1; + } + temp = num; + while (temp &gt; 0) + { + sumOfDigit += temp % 10; + temp /= 10; + } + printf(&quot;\nSum of the digit %d : %d&quot;, num, sumOfDigit); + return 0; +}</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('pc010.c', 'pc010.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc010.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc010-c', 'pc010.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc010.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc010.c</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/practice-c/pc010.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc010.c" 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-practice-c-pc010-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Reverse a number */ +/* Author - Amit Dutta, Date - 04th November, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, temp, rev = 0; + printf(&quot;\nEnter the number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nOnly a number is allowed.&quot;); + return 1; + } + temp = num; + while (temp &gt; 0) + { + rev = (rev * 10) + (temp % 10); + temp /= 10; + } + printf(&quot;\nReverse of the number %d : %d&quot;, num, rev); + return 0; +}</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('pc011.c', 'pc011.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc011.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc011-c', 'pc011.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc011.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc011.c</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/practice-c/pc011.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc011.c" 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-practice-c-pc011-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C program that takes two positive integers, L (Lower Bound) +and U (Upper Bound), as input from the user. The program must find and print +the count of all numbers between L and U (inclusive) that +are also a Palindrome Number. */ +/* Author - Amit Dutta, Date - 11th November, 2025 */ + +#include &lt;stdio.h&gt; +#define true 1 +#define false 0 + +int isPalindrome(int num) +{ + int temp = num, numRev = 0; + while (temp &gt; 0) + { + numRev = (numRev * 10) + (temp % 10); + temp /= 10; + } + if (num == numRev) + return true; + else + return false; +} + +int main() +{ + int uBound, lBound, num, palindromeCount = 0; + printf(&quot;Enter the Lower Bound and Upper Bound : &quot;); + if (scanf(&quot;%d %d&quot;, &amp;lBound, &amp;uBound) != 2) + { + printf(&quot;\nOnly Integer values are allowed.&quot;); + return 1; + } + if (lBound &lt; 0 || uBound &lt; 0 || lBound &gt; uBound) + { + printf(&quot;\nPlease enter appropriate inforamtion.&quot;); + return 1; + } + printf(&quot;Palindrome Numbers from %d to %d :&quot;, lBound, uBound); + for (num = lBound; num &lt;= uBound; num++) + { + if (isPalindrome(num)) + { + printf(&quot; %d&quot;, num); + palindromeCount++; + } + } + printf(&quot;\nTotal Palindrome number found inside the range (%d to %d) : %d&quot;, lBound, uBound, palindromeCount); + return 0; +}</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('pc012.c', 'pc012.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/practice-c/pc012.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-practice-c-pc012-c', 'pc012.c', 'https://github.com/notamitgamer/bsc/blob/main/practice-c/pc012.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">pc012.c</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/practice-c/pc012.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc012.c" 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-practice-c-pc012-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a C function that receives a string (character array) and uses +pointers to count and return the total number of vowels and consonants in that string. */ +/* Author: Amit Dutta, Date: 02-12-2025 */ + +#include &lt;stdio.h&gt; +#include &lt;ctype.h&gt; + +void charCounter(char[], int *, int *); + +int main() +{ + char str[101]; + int vowelCount, consonantCount; + printf(&quot;Enter the string (Max: 100 character): &quot;); + if (fgets(str, sizeof(str), stdin) == NULL) + { + printf(&quot;Error reading input.\n&quot;); + return 1; + } + charCounter(str, &amp;vowelCount, &amp;consonantCount); + printf(&quot;\nVowel Count: %d&quot;, vowelCount); + printf(&quot;\nConsonant Count: %d&quot;, consonantCount); + printf(&quot;\nTotal Character: %d&quot;, vowelCount + consonantCount); + return 0; +} + +void charCounter(char str[], int *vowelCount, int *consonantCount) +{ + int tempVowelCount = 0, tempConsonantCount = 0; + while (*str != &#x27;\0&#x27;) + { + char ch = tolower(*str); + if (isalpha(ch)) + { + if (ch == &#x27;a&#x27; || ch == &#x27;e&#x27; || ch == &#x27;i&#x27; || ch == &#x27;o&#x27; || ch == &#x27;u&#x27;) + { + tempVowelCount++; + } + else + { + tempConsonantCount++; + } + } + str++; + } + + *vowelCount = tempVowelCount; + *consonantCount = tempConsonantCount; +}</div> </div> </div> @@ -1809,1725 +10336,9720 @@ <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('APC-PRAC-001.c', 'APC-PRAC-001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-001-c', 'APC-PRAC-001.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-001.c</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/tuition-c/APC-PRAC-001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-001.c" 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-tuition-c-APC-PRAC-001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate area and perimeter of a rectangle +by accepting length and breadth as input. */ +// Author - Amit Dutta, Date - 18th SEP, 2025 + +#include&lt;stdio.h&gt; +int main() { + double length, breadth, area, perimeter; + printf(&quot;Enter the length and breadth of the Rectangle : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;length, &amp;breadth); + area = length * breadth; + perimeter = 2 * (length + breadth); + printf(&quot;\nArea of the Rectangle : %g&quot; + &quot;\nPerimeter of the Rectangle : %g&quot;, area, perimeter); + return 0; + +} + +</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('APC-PRAC-002.c', 'APC-PRAC-002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-002-c', 'APC-PRAC-002.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-002.c</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/tuition-c/APC-PRAC-002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-002.c" 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-tuition-c-APC-PRAC-002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate area of a circle using math library +method. Take radius of the circle as input. */ +/* Author - Amit Dutta, Date - 18th SEP, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double r, area; + printf(&quot;Enter the radius of the circle : &quot;); + scanf(&quot;%lf&quot;, &amp;r); + area = M_PI * pow(r, 2); + printf(&quot;\nArea of the circle : %g&quot;, area); + return 0; +}</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('APC-PRAC-003.c', 'APC-PRAC-003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-003-c', 'APC-PRAC-003.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-003.c</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/tuition-c/APC-PRAC-003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-003.c" 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-tuition-c-APC-PRAC-003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to accept diagonal of a square and calculate area, parimeter */ +/* Author - Amit Dutta, Date - 18th SEP, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double dia, side, area, peri; + printf(&quot;Enter the diagonal of the square : &quot;); + scanf(&quot;%lf&quot;, &amp;dia); + side = dia / sqrt(2); + area = pow(side, 2); + peri = 4 * side; + printf(&quot;\nArea of the square : %g&quot; + &quot;\nPerimeter of the square : %g&quot;, + area, peri); + return 0; +}</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('APC-PRAC-004.c', 'APC-PRAC-004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-004-c', 'APC-PRAC-004.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-004.c</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/tuition-c/APC-PRAC-004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-004.c" 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-tuition-c-APC-PRAC-004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate and display radius of a circle by taking the area as input. */ +/* Author - Amit Dutta, Date - 18th SEP, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double r, area; + printf(&quot;Enter the area of the circle : &quot;); + scanf(&quot;%lf&quot;, &amp;area); + r = sqrt(area / M_PI); + printf(&quot;\nRadius of the circle : %g&quot;, r); + return 0; +}</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('APC-PRAC-005.c', 'APC-PRAC-005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-005-c', 'APC-PRAC-005.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-005.c</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/tuition-c/APC-PRAC-005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-005.c" 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-tuition-c-APC-PRAC-005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP a program that accept number of days +as input and represent it as years, months and days. */ +/* Author - Amit Dutta, Date - 19th SEP, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int days, months, years, temp; + printf(&quot;Enter the No. of days : &quot;); + scanf(&quot;%d&quot;, &amp;days); + temp = days; + years = days / 365; + days = days % 365; + months = days / 30; + days = days % 30; + printf(&quot;%d Days = %d Years, %d Months, %d Days&quot;, temp, years, months, days); + return 0; +}</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('APC-PRAC-006.c', 'APC-PRAC-006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-006-c', 'APC-PRAC-006.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-006.c</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/tuition-c/APC-PRAC-006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-006.c" 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-tuition-c-APC-PRAC-006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP that accept seconds as input and represent it an hours, minutes and seconds. */ +/* Author - Amit Dutta, Date - 19th SEP, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int sec, hours, minutes, temp; + printf(&quot;Enter the no of seconds : &quot;); + scanf(&quot;%d&quot;, &amp;sec); + temp = sec; + hours = sec / 3600; + sec = sec % 3600; + minutes = sec / 60; + sec = sec % 60; + printf(&quot;\n%d Seconds = %d Hours, %d Minutes, %d Seconds.&quot;, temp, hours, minutes, sec); + return 0; +}</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('APC-PRAC-007.c', 'APC-PRAC-007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-007-c', 'APC-PRAC-007.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-007.c</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/tuition-c/APC-PRAC-007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-007.c" 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-tuition-c-APC-PRAC-007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP that accept basic salary of an employee and display gross salary, +net salary generated by below formula. + DA = 25% of the basic salary. + HRA = 12.5% of the basic salary. + PF = 10% of the basic salary. + gross salary = basic salary + da + hra + net salary = gross salary - pf +*/ +/* Author - Amit Dutta, Date - 19th SEP, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + double bs, gs, ns, da, hra, pf; + printf(&quot;Enter the basic salary of the employee : &quot;); + scanf(&quot;%lf&quot;, &amp;bs); + da = bs * 0.25; + hra = bs * 0.125; + pf = bs * 0.10; + gs = bs + da + hra; + ns = gs - pf; + printf(&quot;\nGross Salary : %g&quot; + &quot;\nNet Salary : %g&quot;, + gs, ns); + return 0; +}</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('APC-PRAC-008.c', 'APC-PRAC-008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-008-c', 'APC-PRAC-008.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-008.c</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/tuition-c/APC-PRAC-008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-008.c" 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-tuition-c-APC-PRAC-008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to multiply and divide a number by 4 without +using multiplication and division operator. */ +/* Author - Amit Dutta, Date - 19th SEP, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, multi, div; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + multi = num &lt;&lt; 2; + div = num &gt;&gt; 2; + printf(&quot;Multiplication : %d&quot; + &quot;\nDivision : %d&quot;, + multi, div); + return 0; +}</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('APC-PRAC-009.c', 'APC-PRAC-009.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-009.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-009-c', 'APC-PRAC-009.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-009.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-009.c</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/tuition-c/APC-PRAC-009.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-009.c" 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-tuition-c-APC-PRAC-009-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to swap two integer variable without using Third variable. */ +/* Author - Amit Dutta, Date - 19th SEP, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int a = 4, b = 6; + printf(&quot;Before swap : A = %d and B = %d&quot;, a, b); + a = a ^ b; + b = a ^ b; + a = a ^ b; + printf(&quot;\nAfter swap : A = %d and B = %d&quot;, a, b); + return 0; +}</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('APC-PRAC-010.c', 'APC-PRAC-010.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-010.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-010-c', 'APC-PRAC-010.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-010.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-010.c</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/tuition-c/APC-PRAC-010.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-010.c" 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-tuition-c-APC-PRAC-010-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate and display the valve of the given expression : + (1/a^3) + (1/(b+2)^3) + (1/(c^4 + root(2))) + take a, b, c as input. +*/ +/* Author - Amit Dutta, Date - 19th SEP, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + double a, b, c, result; + printf(&quot;Enter the value for a, b and c : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;a, &amp;b, &amp;c); + result = (1 / pow(a, 3)) + (1 / pow((b + 2), 3)) + (1 / (pow(c, 4) + sqrt(2))); + printf(&quot;\nResult = %g&quot;, result); + return 0; +}</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('APC-PRAC-011.c', 'APC-PRAC-011.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-011.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-011-c', 'APC-PRAC-011.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-011.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-011.c</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/tuition-c/APC-PRAC-011.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-011.c" 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-tuition-c-APC-PRAC-011-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input positive number and check whether the number is +perfect square or not. If the number is negetive then display appropriate message */ +/* Author - Amit Dutta, Date - 31st October, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num, temp; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + if (num &lt; 0) + { + printf(&quot;\nYou entered a negetive number.&quot;); + return 1; + } + temp = (int)sqrt(num); + if (temp * temp == num) + { + printf(&quot;\nInput %d is a perfect square number.&quot;, num); + return 0; + } + else + printf(&quot;\nInput %d is not a perfect square number.&quot;, num); + return 0; +}</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('APC-PRAC-012.c', 'APC-PRAC-012.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-012.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-012-c', 'APC-PRAC-012.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-012.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-012.c</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/tuition-c/APC-PRAC-012.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-012.c" 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-tuition-c-APC-PRAC-012-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input three integer and find out second largest */ +/* Author - Amit Dutta, Date - 31st October, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int a, b, c, secondLargest; + printf(&quot;Enter three number : &quot;); + scanf(&quot;%d %d %d&quot;, &amp;a, &amp;b, &amp;c); + if ((a &lt; b &amp;&amp; a &gt; c) || (a &gt; b &amp;&amp; a &lt; c)) + secondLargest = a; + if ((b &lt; a &amp;&amp; b &gt; c) || (b &gt; a &amp;&amp; b &lt; c)) + secondLargest = b; + if ((c &lt; b &amp;&amp; c &gt; a) || (c &gt; b &amp;&amp; c &lt; a)) + secondLargest = c; + printf(&quot;\nSecond Largest : %d&quot;, secondLargest); + return 0; +}</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('APC-PRAC-013.c', 'APC-PRAC-013.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-013.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-013-c', 'APC-PRAC-013.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-013.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-013.c</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/tuition-c/APC-PRAC-013.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-013.c" 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-tuition-c-APC-PRAC-013-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input sum(p), rate of interest(r), time(t) and type of interest +(&#x27;s&#x27; for simple interes, &#x27;c&#x27; for compound interest), then calculate and display the earned interest */ +/* Author - Amit Dutta, Date - 31st October, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;ctype.h&gt; + +int main() +{ + double p, t, r, si, ci; + char mode; + printf(&quot;Enter the Principle, Time (Year) and the Rate of Interest : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;p, &amp;t, &amp;r); + printf(&quot;Enter the mode of calculation (&#x27;s&#x27; for simple interest, &#x27;c&#x27; for compound interest) : &quot;); + scanf(&quot; %c&quot;, &amp;mode); + mode = tolower(mode); + switch (mode) + { + case &#x27;s&#x27;: + si = (p * t * r) / 100; + printf(&quot;\nSimple Interest : %g&quot;, si); + return 0; + case &#x27;c&#x27;: + ci = (p * pow(1 + (r / 100), t)) - p; + printf(&quot;\nCompound Interest : %g&quot;, ci); + return 0; + default: + printf(&quot;\nYou entered a wrong choice.&quot;); + return 1; + } +}</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('APC-PRAC-014.c', 'APC-PRAC-014.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-014.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-014-c', 'APC-PRAC-014.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-014.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-014.c</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/tuition-c/APC-PRAC-014.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-014.c" 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-tuition-c-APC-PRAC-014-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to calculate and display the maturity amount taking +the sum and number of days as input. + No. of Days Rate of Interest + =========== ================ + &lt;= 180 5.57 % + 181 - 364 7.75 % + 365 - 500 9.25 % + &gt; 500 9.15 % +*/ +/* Author - Amit Dutta, Date - 31st October, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + double p, t, r, si; + int days; + printf(&quot;Enter the Principle, Time (Days) : &quot;); + scanf(&quot;%lf %d&quot;, &amp;p, &amp;days); + if (days &gt; 0 &amp;&amp; days &lt;= 180) + r = 5.57; + else if (days &gt; 180 &amp;&amp; days &lt;= 364) + r = 7.75; + else if (days &gt; 364 &amp;&amp; days &lt;= 500) + r = 9.25; + else if (days &gt; 500) + r = 9.15; + si = (p * t * r) / 100; + printf(&quot;\nMaturity Amount : %d&quot;, si + p); + return 0; +}</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('APC-PRAC-015.c', 'APC-PRAC-015.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-015.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-015-c', 'APC-PRAC-015.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-015.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-015.c</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/tuition-c/APC-PRAC-015.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-015.c" 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-tuition-c-APC-PRAC-015-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to display all numbers between lb (lower bound) and up (upper bound) +which ends with digit 7 or divisible by 7. */ +/* Author - Amit Dutta, Date - 06th November, 2025 */ +// File Name - amit0611202501.c (LAB), APC-PRAC-015.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int lb, ub, i; + printf(&quot;Enter the lb, ub : &quot;); + scanf(&quot;%d %d&quot;, &amp;lb, &amp;ub); + printf(&quot;\nEnds with 7 :&quot;); + for (i = lb; i &lt;= ub; i++) + { + if (i % 10 == 7) + { + printf(&quot; %d&quot;, i); + } + } + printf(&quot;\nDivisible by 7 :&quot;); + for (i = lb; i &lt;= ub; i++) + { + if (i % 7 == 0) + { + printf(&quot; %d&quot;, i); + } + } + return 0; +}</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('APC-PRAC-016.c', 'APC-PRAC-016.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-016.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-016-c', 'APC-PRAC-016.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-016.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-016.c</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/tuition-c/APC-PRAC-016.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-016.c" 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-tuition-c-APC-PRAC-016-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check palindrome number. */ +/* Author - Amit Dutta, Date - 06th November, 2025 */ +// File Name - amit0611202502.c (LAB), APC-PRAC-016.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int num, temp, rev = 0; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + temp = num; + while (temp &gt; 0) + { + rev = (rev * 10) + (temp % 10); + temp /= 10; + } + if (rev == num) + printf(&quot;\nInput %d is a palindrome number.&quot;, num); + else + printf(&quot;\nInput %d is not a palindrome number.&quot;, num); + return 0; +}</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('APC-PRAC-017.c', 'APC-PRAC-017.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-017.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-017-c', 'APC-PRAC-017.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-017.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-017.c</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/tuition-c/APC-PRAC-017.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-017.c" 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-tuition-c-APC-PRAC-017-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check perfect number. */ +/* Author - Amit Dutta, Date - 06th November, 2025 */ +// File Name - amit0611202503.c (LAB), APC-PRAC-017.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int num, i, divisibleSum = 0; + printf(&quot;Enter a number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + for (i = 1; i &lt;= num / 2; i++) + { + if (num % i == 0) + { + divisibleSum += i; + } + } + if (divisibleSum == num) + printf(&quot;\nInput %d ia a Perfect Number.&quot;, num); + else + printf(&quot;\nInput %d is NOT a Perfect Number.&quot;, num); + return 0; +}</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('APC-PRAC-018.c', 'APC-PRAC-018.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-018.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-018-c', 'APC-PRAC-018.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-018.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-018.c</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/tuition-c/APC-PRAC-018.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-018.c" 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-tuition-c-APC-PRAC-018-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check Automorphic Number. */ +/* Author - Amit Dutta, Date - 06th November, 2025 */ +// File Name - amit0611202504.c (LAB), APC-PRAC-018.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num, square, count = 0, temp, modNum; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + square = (int)pow(num, 2); + temp = num; + while (temp &gt; 0) + { + temp /= 10; + count++; + } + modNum = (int)pow(10, count); + temp = square % modNum; + if (num == temp) + printf(&quot;\nInput %d is a Automorphic Number.&quot;, num); + else + printf(&quot;\nInput %d is a Automorphic Number.&quot;, num); + return 0; +}</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('APC-PRAC-019.c', 'APC-PRAC-019.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-019.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-019-c', 'APC-PRAC-019.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-019.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-019.c</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/tuition-c/APC-PRAC-019.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-019.c" 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-tuition-c-APC-PRAC-019-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find hcf of two numbers */ +/* Author - Amit Dutta, Date - 07th November, 2025 */ +// File Name - amit0711202501.c (LAB), APC-PRAC-019.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int a, b, temp, temp_a, temp_b; + printf(&quot;Enter the a and b : &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + temp_a = a, temp_b = b; + while (b &gt; 0) + { + temp = a; + a = b; + b = temp % b; + } + printf(&quot;\nHCF of %d and %d is : %d\n&quot;, temp_a, temp_b, a); + return 0; +}</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('APC-PRAC-020.c', 'APC-PRAC-020.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-020.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-020-c', 'APC-PRAC-020.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-020.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-020.c</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/tuition-c/APC-PRAC-020.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-020.c" 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-tuition-c-APC-PRAC-020-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check if two number is co-prime or not */ +/* Author - Amit Dutta, Date - 07th November, 2025 */ +// File Name - amit0711202502.c (LAB), APC-PRAC-020.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int a, b, temp, temp_a, temp_b; + printf(&quot;Enter the a and b : &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + temp_a = a, temp_b = b; + while (b &gt; 0) + { + temp = a; + a = b; + b = temp % b; + } + if (a == 1) + printf(&quot;\n%d and %d is co-prime\n&quot;, temp_a, temp_b); + else + printf(&quot;\n%d and %d is NOT co-prime\n&quot;, temp_a, temp_b); + return 0; +}</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('APC-PRAC-021.c', 'APC-PRAC-021.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-021.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-021-c', 'APC-PRAC-021.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-021.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-021.c</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/tuition-c/APC-PRAC-021.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-021.c" 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-tuition-c-APC-PRAC-021-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check special number (sum of digit + product of digit = original number) */ +/* Author - Amit Dutta, Date - 07th November, 2025 */ +// File Name - amit0711202503.c (LAB), APC-PRAC-021.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int num, temp, sumOfDigit = 0, productOfDigit = 1; + printf(&quot;Enter the number to check if it is a special number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + temp = num; + while (temp &gt; 0) + { + sumOfDigit += temp % 10; + productOfDigit *= temp % 10; + temp /= 10; + } + temp = sumOfDigit + productOfDigit; + if (num == temp) + printf(&quot;\nInput %d is a special number.&quot;, num); + else + printf(&quot;\nInput %d is not a special number.&quot;, num); + return 0; +}</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('APC-PRAC-022.c', 'APC-PRAC-022.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-022.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-022-c', 'APC-PRAC-022.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-022.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-022.c</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/tuition-c/APC-PRAC-022.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-022.c" 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-tuition-c-APC-PRAC-022-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to accept a number and check whether the number is twisted prime or not */ +/* Author - Amit Dutta, Date - 07th November, 2025 */ +// File Name - amit0711202504.c (LAB), APC-PRAC-022.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdbool.h&gt; + +bool checkPrime(int num) +{ + if (num &lt; 2) + return false; + if (num == 2) + return true; + if (num % 2 == 0) + return false; + int limit = (int)sqrt(num); + for (int i = 3; i &lt;= limit; i += 2) + if (num % i == 0) + return false; + return true; +} + +int reverseNumber(int num) +{ + int reverse = 0; + while (num &gt; 0) + { + reverse = (reverse * 10) + (num % 10); + num /= 10; + } + return reverse; +} + +int main() +{ + int num; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + if (!checkPrime(num)) + { + printf(&quot;\nInput %d is not a prime number.&quot;, num); + return 0; + } + if (checkPrime(reverseNumber(num))) + printf(&quot;\nInput %d is a twisted prime number.&quot;, num); + else + printf(&quot;\nInput %d is not a twisted prime number.&quot;, num); + return 0; +}</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('APC-PRAC-023.c', 'APC-PRAC-023.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-023.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-023-c', 'APC-PRAC-023.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-023.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-023.c</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/tuition-c/APC-PRAC-023.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-023.c" 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-tuition-c-APC-PRAC-023-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Pattern : + (a) 1, -3, 5, -7, 9, -11, ... upto n times + (b) 0, 3, 8, 15, ... upto n times +*/ +/* Author - Amit Dutta, Date - 07th November, 2025 */ +// File Name - amit0711202505.c (LAB), APC-PRAC-023.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;stdbool.h&gt; + +int main() +{ + int n, i, temp = 1; + bool isNegative = true; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + printf(&quot;\nPattern A :&quot;); + for (i = 1; i &lt;= n; i++) + { + if (!isNegative) + { + printf(&quot; %d&quot;, temp * -1); + isNegative = true; + } + else + { + printf(&quot; %d&quot;, temp); + isNegative = false; + } + temp += 2; + } + printf(&quot;\nPattern B :&quot;); + for (i = 1; i &lt;= n; i++) + { + temp = (i * i) - 1; + printf(&quot; %d&quot;, temp); + } + return 0; +}</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('APC-PRAC-024.c', 'APC-PRAC-024.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-024.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-024-c', 'APC-PRAC-024.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-024.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-024.c</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/tuition-c/APC-PRAC-024.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-024.c" 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-tuition-c-APC-PRAC-024-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 1 + 2 1 + 3 2 1 + 4 3 2 1 + 5 4 3 2 1 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202501.c (LAB), APC-PRAC-024.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = i; j &gt;= 1; j--) { + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-025.c', 'APC-PRAC-025.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-025.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-025-c', 'APC-PRAC-025.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-025.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-025.c</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/tuition-c/APC-PRAC-025.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-025.c" 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-tuition-c-APC-PRAC-025-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 5 4 3 2 1 + 5 4 3 2 + 5 4 3 + 5 4 + 5 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202502.c (LAB), APC-PRAC-025.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = n; j &gt;= i; j--) { + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-026.c', 'APC-PRAC-026.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-026.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-026-c', 'APC-PRAC-026.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-026.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-026.c</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/tuition-c/APC-PRAC-026.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-026.c" 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-tuition-c-APC-PRAC-026-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 5 + 5 4 + 5 4 3 + 5 4 3 2 + 5 4 3 2 1 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202503.c (LAB), APC-PRAC-026.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = n; i &gt;= 1; i--) { + for(j = n; j &gt;= i; j--) { + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-027.c', 'APC-PRAC-027.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-027.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-027-c', 'APC-PRAC-027.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-027.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-027.c</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/tuition-c/APC-PRAC-027.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-027.c" 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-tuition-c-APC-PRAC-027-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 1 2 3 4 5 + 2 3 4 5 + 3 4 5 + 4 5 + 5 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202504.c (LAB), APC-PRAC-027.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = i; j &lt;= n; j++) { + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-028.c', 'APC-PRAC-028.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-028.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-028-c', 'APC-PRAC-028.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-028.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-028.c</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/tuition-c/APC-PRAC-028.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-028.c" 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-tuition-c-APC-PRAC-028-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 1 + 2 3 + 4 5 6 + 7 8 9 10 + 11 12 13 14 15 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202505.c (LAB), APC-PRAC-028.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j, temp = 1; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = 1; j &lt;= i; j++) { + printf(&quot;%d\t&quot;, temp); + temp++; + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-029.c', 'APC-PRAC-029.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-029.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-029-c', 'APC-PRAC-029.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-029.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-029.c</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/tuition-c/APC-PRAC-029.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-029.c" 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-tuition-c-APC-PRAC-029-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 1 + 1 0 + 1 0 1 + 1 0 1 0 + 1 0 1 0 1 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202506.c (LAB), APC-PRAC-029.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = 1; j &lt;= i; j++) { + if(j % 2 == 0) printf(&quot;0 &quot;); + else printf(&quot;1 &quot;); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-030.c', 'APC-PRAC-030.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-030.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-030-c', 'APC-PRAC-030.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-030.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-030.c</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/tuition-c/APC-PRAC-030.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-030.c" 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-tuition-c-APC-PRAC-030-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + # + @ @ + # # # + @ @ @ @ + # # # # # +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202507.c (LAB), APC-PRAC-030.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = 1; j &lt;= i; j++) { + if(i % 2 == 0) printf(&quot;@ &quot;); + else printf(&quot;# &quot;); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-031.c', 'APC-PRAC-031.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-031.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-031-c', 'APC-PRAC-031.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-031.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-031.c</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/tuition-c/APC-PRAC-031.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-031.c" 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-tuition-c-APC-PRAC-031-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + 1 2 3 4 5 + 6 7 8 9 + 10 11 12 + 13 14 + 15 +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202508.c (LAB), APC-PRAC-031.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j, temp = 1; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = n; i &gt;= 1; i--) { + for(j = 1; j &lt;= i; j++) { + printf(&quot;%d\t&quot;, temp); + temp++; + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-032.c', 'APC-PRAC-032.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-032.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-032-c', 'APC-PRAC-032.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-032.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-032.c</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/tuition-c/APC-PRAC-032.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-032.c" 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-tuition-c-APC-PRAC-032-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Pattern: + A + B B + C C C + D D D D + E E E E E +*/ +/* Author = Amit Dutta, Date - 13th November, 2025 */ +// File Name - amit1311202509.c (LAB), APC-PRAC-032.c (Local) + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include&lt;stdio.h&gt; +int main() { + int n, i, j; char temp = &#x27;A&#x27;; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for(i = 1; i &lt;= n; i++) { + for(j = 1; j &lt;= i; j++) { + printf(&quot;%c\t&quot;, temp); + } + temp++; + printf(&quot;\n&quot;); + } + return 0; +} +</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('APC-PRAC-033.c', 'APC-PRAC-033.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-033.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-033-c', 'APC-PRAC-033.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-033.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-033.c</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/tuition-c/APC-PRAC-033.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-033.c" 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-tuition-c-APC-PRAC-033-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Print the factorial of the digits off a number */ +/* Auhtor: Amit Dutta, Date: 20-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int factorial(int); + +int factorial(int n) +{ + int i, fact = 1; + for (i = 1; i &lt;= n; i++) + fact *= i; + return fact; +} + +int main() +{ + int n, temp; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (n &lt; 0) + { + printf(&quot;Only non-negetive number is allowed.&quot;); + return 1; + } + temp = n; + while (temp &gt; 0) + { + printf(&quot;\nFactorial of %d: %d&quot;, temp % 10, factorial(temp % 10)); + temp /= 10; + } + return 0; +}</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('APC-PRAC-034.c', 'APC-PRAC-034.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-034.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-034-c', 'APC-PRAC-034.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-034.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-034.c</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/tuition-c/APC-PRAC-034.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-034.c" 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-tuition-c-APC-PRAC-034-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Take a Range as input from user and print the prime number between it. */ +/* Auhtor: Amit Dutta, Date: 20-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int isPrime(int); + +int isPrime(int n) +{ + if (n &lt;= 1) + return 0; + if (n == 2) + return 1; + if (n % 2 == 0) + return 0; + int temp = (int)sqrt(n), i; + for (i = 3; i &lt;= temp; i += 2) + if (n % i == 0) + return 0; + return 1; +} + +int main() +{ + int lb, ub, i; + printf(&quot;Enter the lower bound and the upper bound: &quot;); + scanf(&quot;%d %d&quot;, &amp;lb, &amp;ub); + printf(&quot;\nPrime numbers between %d and %d: &quot;, lb, ub); + for (i = lb; i &lt;= ub; i++) + if (isPrime(i)) + printf(&quot;%d &quot;, i); + return 0; +}</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('APC-PRAC-035.c', 'APC-PRAC-035.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-035.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-035-c', 'APC-PRAC-035.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-035.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-035.c</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/tuition-c/APC-PRAC-035.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-035.c" 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-tuition-c-APC-PRAC-035-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Print all the 3 and 4 digit palindrome number. */ +/* Auhtor: Amit Dutta, Date: 20-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int palindromeCheck(int); + +int palindromeCheck(int n) +{ + int temp = n, rev = 0; + while (temp &gt; 0) + { + rev = (rev * 10) + (temp % 10); + temp /= 10; + } + if (rev == n) + return 1; + else + return 0; +} + +int main() +{ + int i; + printf(&quot;Palindrome number of 3 and 4 digits: &quot;); + for (i = 100; i &lt;= 9999; i++) + if (palindromeCheck(i)) + printf(&quot;%d &quot;, i); + return 0; +}</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('APC-PRAC-036.c', 'APC-PRAC-036.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-036.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-036-c', 'APC-PRAC-036.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-036.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-036.c</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/tuition-c/APC-PRAC-036.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-036.c" 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-tuition-c-APC-PRAC-036-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Check krishnamurty number. */ +/* Auhtor: Amit Dutta, Date: 20-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int factorial(int); +int checkKrishnamurty(int); + +int factorial(int n) +{ + int i, fact = 1; + for (i = 1; i &lt;= n; i++) + fact *= i; + return fact; +} + +int checkKrishnamurty(int n) +{ + int temp1 = n, temp2 = 0; + while (temp1 &gt; 0) + { + temp2 += factorial(temp1 % 10); + temp1 /= 10; + } + if (temp2 == n) + return 1; + else + return 0; +} + +int main() +{ + int n; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (checkKrishnamurty(n)) + printf(&quot;\nInput %d is a Krishnamurty number.&quot;, n); + else + printf(&quot;\ninput %d is not a Krishnamurty number.&quot;, n); + return 0; +}</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('APC-PRAC-037.c', 'APC-PRAC-037.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-037.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-037-c', 'APC-PRAC-037.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-037.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-037.c</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/tuition-c/APC-PRAC-037.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-037.c" 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-tuition-c-APC-PRAC-037-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Show all the armstrong number between a range. */ +/* Author: Amit Dutta, Date: 21-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +#define lowerBound 100 +#define upperBound 999 + +int isArmstrongNumber(int); + +int isArmstrongNumber(int n) +{ + int temp = n, sum = 0, count = 0; + while (temp &gt; 0) + { + count++; + temp /= 10; + } + temp = n; + while (temp &gt; 0) + { + sum += (int)pow(temp % 10, count); + temp /= 10; + } + return sum == n; +} + +int main() +{ + int n, i, count = 0; + printf(&quot;Armstrong number between %d and %d are: &quot;, lowerBound, upperBound); + for (i = lowerBound; i &lt;= upperBound; i++) + if (isArmstrongNumber(i)) + { + printf(&quot;%d &quot;, i); + count++; + } + printf(&quot;\n\nCount: %d\n&quot;, count); + return 0; +}</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('APC-PRAC-038.c', 'APC-PRAC-038.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-038.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-038-c', 'APC-PRAC-038.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-038.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-038.c</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/tuition-c/APC-PRAC-038.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-038.c" 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-tuition-c-APC-PRAC-038-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Print all combinations of two two-digit numbers such that the sum of digits of both numbers is equal. +Example: 23 and 41 → (2+3) = 5, (4+1) = 5. +*/ +/* Author: Amit Dutta, Date: 21-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + printf(&quot;Combinations of two two-digit numbers such that the sum of digits of both numbers is equal: &quot;); + int i, j, sum1, sum2, count = 0; + for (i = 10; i &lt;= 99; i++) + { + sum1 = (i % 10) + (i / 10); + for (j = i + 1; j &lt;= 99; j++) + { + sum2 = (j % 10) + (j / 10); + if (sum1 == sum2) + { + printf(&quot;(%d, %d) &quot;, i, j); + count++; + } + } + } + printf(&quot;\nCount: %d\n&quot;, count); + return 0; +}</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('APC-PRAC-039.c', 'APC-PRAC-039.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-039.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-039-c', 'APC-PRAC-039.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-039.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-039.c</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/tuition-c/APC-PRAC-039.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-039.c" 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-tuition-c-APC-PRAC-039-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Write a C program to print all unique combinations of three numbers (a, b, c) such that: +1 ≤ a, b, c ≤ 30 and a² + b² = c² (Pythagorean triplets) +*/ +/* Author: Amit Dutta, Date: 21-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + printf(&quot;a² + b² = c² : &quot;); + int i, j, k, sq1, sq2, count = 0; + for (i = 1; i &lt;= 30; i++) + { + sq1 = i * i; + for (j = i + 1; j &lt;= 30; j++) + { + sq2 = j * j; + for (k = j + 1; k &lt;= 30; k++) + { + if (sq1 + sq2 == k * k) + { + printf(&quot;(%d, %d, %d) &quot;, i, j, k); + count++; + } + } + } + } + printf(&quot;\n\nCount: %d\n&quot;, count); + return 0; +}</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('APC-PRAC-040.c', 'APC-PRAC-040.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-040.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-040-c', 'APC-PRAC-040.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-040.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-040.c</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/tuition-c/APC-PRAC-040.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-040.c" 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-tuition-c-APC-PRAC-040-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Write a C program to count how many numbers between 100 and 999 have all distinct digits (e.g., 123, 709, 981). +*/ +/* Author: Amit Dutta, Date: 21-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int i, count = 0, n1, n2, n3; + printf(&quot;Distinct numbers between 100 and 999: &quot;); + for (i = 100; i &lt;= 999; i++) + { + n1 = i / 100; + n2 = (i % 100) / 10; + n3 = i % 10; + if (n1 != n2 &amp;&amp; n2 != n3 &amp;&amp; n1 != n3) + { + printf(&quot;%d &quot;, i); + count++; + } + } + printf(&quot;\nCount: %d\n&quot;, count); + return 0; +}</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('APC-PRAC-041.c', 'APC-PRAC-041.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-041.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-041-c', 'APC-PRAC-041.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-041.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-041.c</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/tuition-c/APC-PRAC-041.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-041.c" 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-tuition-c-APC-PRAC-041-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* +Write a C program to find and print all twin prime pairs between 1 and n using nested loops. +(Twin primes are prime numbers having a difference of 2, like 11 and 13) +*/ +/* Author: Amit Dutta, Date: 21-11-2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int isPrime(int n) +{ + if (n &lt; 2) + return 0; + if (n == 2) + return 1; + if (n % 2 == 0) + return 0; + int i, temp = (int)sqrt(n); + for (i = 3; i &lt;= temp; i += 2) + if (n % i == 0) + return 0; + return 1; +} + +int main() +{ + int n, i, count = 0; + printf(&quot;enter the n: &quot;); + scanf(&quot;%d&quot;, &amp;n); + printf(&quot;\nAll the twin numbers: &quot;); + for (i = 1; i &lt;= n - 2; i++) + { + if (isPrime(i)) + { + if (isPrime(i + 2)) + { + printf(&quot;(%d, %d) &quot;, i, i + 2); + count++; + } + } + } + printf(&quot;\nCount; %d&quot;, count); + return 0; +}</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('APC-PRAC-042.c', 'APC-PRAC-042.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-PRAC-042.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-PRAC-042-c', 'APC-PRAC-042.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-042.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-PRAC-042.c</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/tuition-c/APC-PRAC-042.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-042.c" 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-tuition-c-APC-PRAC-042-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a function to check whether a given string is a palindrome. Use this function to +determine whether an entered string is Palindrome. */ + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; + +int isPalindrome(char[]); + +int main() +{ + char input[100]; + int len; + + printf(&quot;Enter the string (Max: 100 Character): &quot;); + fgets(input, sizeof(input), stdin); + len = strlen(input); + + if (len &gt; 0 &amp;&amp; input[len - 1] == &#x27;\n&#x27;) + { + input[len - 1] = &#x27;\0&#x27;; + } + + if (isPalindrome(input)) + { + printf(&quot;\nInput string \&quot;%s\&quot; is Palindrome.&quot;, input); + } + else + { + printf(&quot;\nInput string \&quot;%s\&quot; is not Palindrome&quot;, input); + } + + return 0; +} + +int isPalindrome(char str[]) +{ + char *start = str; + char *end; + int len = strlen(str); + + if (len == 0) + { + return 1; + } + + end = str + (len - 1); + + while (start &lt; end) + { + if (*start != *end) + { + return 0; + } + start++; + end--; + } + + return 1; +}</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('APC-S-001.c', 'APC-S-001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-001-c', 'APC-S-001.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-001.c</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/tuition-c/APC-S-001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-001.c" 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-tuition-c-APC-S-001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +#include&lt;stdio.h&gt; +int main() { + int a = 9, b = 4, c; + c = a + b; + printf(&quot;A + B = %d\n&quot;, c); + c = a / b; + printf(&quot;A / B = %d\n&quot;, c); + c = a % b; + printf(&quot;A %% B = %d\n&quot;, c); + return 0; +} +</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('APC-S-002.c', 'APC-S-002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-002-c', 'APC-S-002.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-002.c</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/tuition-c/APC-S-002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-002.c" 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-tuition-c-APC-S-002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +#include&lt;stdio.h&gt; +int main() { + int a = 5, b = 5, c = 10; + printf(&quot;a = b = %d\n&quot;, a == b); + printf(&quot;a &gt; b = %d\n&quot;, a &gt; b); + printf(&quot;a &lt; b = %d\n&quot;, a &lt; b); + return 0; +} +</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('APC-S-003.c', 'APC-S-003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-003-c', 'APC-S-003.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-003.c</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/tuition-c/APC-S-003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-003.c" 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-tuition-c-APC-S-003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +#include &lt;stdio.h&gt; +int main() { + int a = 5, b = 5, c = 10, result; + + result = (a == b) &amp;&amp; (c &gt; b); + printf(&quot;Result is %d\n&quot;, result); + + result = (a == b) &amp;&amp; (c &lt; b); + printf(&quot;Result is %d\n&quot;, result); + + result = (a != b) || (c &lt; b); + printf(&quot;Result is %d\n&quot;, result); + + result = (a != b) || (c &lt; b); + printf(&quot;Result is %d\n&quot;, result); + + result = !(a != b); + printf(&quot;Result is %d\n&quot;, result); + + result = !(a == b); + printf(&quot;Result is %d\n&quot;, result); + + return 0; +} +</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('APC-S-004.c', 'APC-S-004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-004-c', 'APC-S-004.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-004.c</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/tuition-c/APC-S-004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-004.c" 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-tuition-c-APC-S-004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Program to print first 10 natural numbers using while loop. */ +/* Author - Amit Dutta, Date - 29th October, 2025 */ + +/* + * Compiler Note: This source code is specifically designed for compilation + * and execution within the ** Turbo C ** environment. + * + * Testing Disclaimer: Due to a lack of access to the required Turbo C + * compiler software, this code has not been formally compiled or tested. + */ + +#include &lt;stdio.h&gt; +#include &lt;conio.h&gt; + +void main() +{ + clrscr(); + int x; + x = 1; + while (x &lt;= 10) + { + printf(&quot;%d &quot;, x); + x++; + } + getch(); +}</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('APC-S-005.c', 'APC-S-005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-005-c', 'APC-S-005.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-005.c</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/tuition-c/APC-S-005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-005.c" 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-tuition-c-APC-S-005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write to reverse a number. */ +/* Author - Amit Dutta, Date - 29th October, 2025 */ + +/* + * Compiler Note: This source code is specifically designed for compilation + * and execution within the ** Turbo C ** environment. + * + * Testing Disclaimer: Due to a lack of access to the required Turbo C + * compiler software, this code has not been formally compiled or tested. + */ + +#include &lt;stdio.h&gt; +#include &lt;conio.h&gt; + +void main() +{ + clrscr(); + int n, reverse = 0, rem; + printf(&quot;Enter the numner : &quot;); + scanf(&quot;%d&quot;, &amp;n); + while (n != 0) + { + rem = n % 10; + reverse = reverse * 10 + rem; + n /= 10; + } + printf(&quot;Reversed Number : %d&quot;, reverse); + getch(); +}</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('APC-S-006.c', 'APC-S-006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-006-c', 'APC-S-006.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-006.c</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/tuition-c/APC-S-006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-006.c" 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-tuition-c-APC-S-006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print first 10 multiple of 5 */ +/* Author - Amit Dutta, Date - 29th October, 2025 */ + +/* + * Compiler Note: This source code is specifically designed for compilation + * and execution within the ** Turbo C ** environment. + * + * Testing Disclaimer: Due to a lack of access to the required Turbo C + * compiler software, this code has not been formally compiled or tested. + */ + +#include &lt;stdio.h&gt; +#include &lt;conio.h&gt; + +void main() +{ + clrscr(); + int a = 5, i = 1, res; + while (i &lt;= 10) + { + res = a * i; + printf(&quot;%d * %d = %d\n&quot;, a, i, res); + i++; + } + getch(); +}</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('APC-S-007.c', 'APC-S-007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-007-c', 'APC-S-007.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-007.c</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/tuition-c/APC-S-007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-007.c" 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-tuition-c-APC-S-007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program the sum of first 10 natural numbers. */ +/* Author - Amit Dutta, Date - 29th October, 2025 */ + +/* + * Compiler Note: This source code is specifically designed for compilation + * and execution within the ** Turbo C ** environment. + * + * Testing Disclaimer: Due to a lack of access to the required Turbo C + * compiler software, this code has not been formally compiled or tested. + */ + +#include &lt;stdio.h&gt; +#include &lt;conio.h&gt; + +void main() +{ + clrscr(); + int i, sum = 0; + for (i = 1; i &lt;= 10; i++) + { + sum += i; + } + printf(&quot;\nSum of the first natural number : %d&quot;, sum); + getch(); +}</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('APC-S-008.c', 'APC-S-008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-008-c', 'APC-S-008.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-008.c</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/tuition-c/APC-S-008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-008.c" 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-tuition-c-APC-S-008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print the sum of two matrix as input given by the user. */ +/* Author: Amit Dutta, Date: 18-11-2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int rows, cols, i, j; + printf(&quot;Enter the number of rows and columns: &quot;); + scanf(&quot;%d %d&quot;, &amp;rows, &amp;cols); + + int a[rows][cols], b[rows][cols], c[rows][cols]; + + printf(&quot;Enter the elements of matrix A (%d x %d): \n&quot;, rows, cols); + for (i = 0; i &lt; rows; i++) + for (j = 0; j &lt; cols; j++) + { + printf(&quot;Position %d%d: &quot;, i, j); + scanf(&quot;%d&quot;, &amp;a[i][j]); + } + printf(&quot;\nMatrix A: \n&quot;); + for (i = 0; i &lt; rows; i++) + { + for (j = 0; j &lt; cols; j++) + printf(&quot;%d &quot;, a[i][j]); + printf(&quot;\n&quot;); + } + + printf(&quot;\nEnter the elements of matrix B(%d x %d): \n&quot;, rows, cols); + for (i = 0; i &lt; rows; i++) + for (j = 0; j &lt; cols; j++) + { + printf(&quot;Position %d%d: &quot;, i, j); + scanf(&quot;%d&quot;, &amp;b[i][j]); + } + printf(&quot;\nMatrix B: \n&quot;); + for (i = 0; i &lt; rows; i++) + { + for (j = 0; j &lt; cols; j++) + printf(&quot;%d &quot;, b[i][j]); + printf(&quot;\n&quot;); + } + + for (i = 0; i &lt; rows; i++) + for (j = 0; j &lt; cols; j++) + c[i][j] = a[i][j] + b[i][j]; + + printf(&quot;\nResult Matrix: \n&quot;); + for (i = 0; i &lt; rows; i++) + { + for (j = 0; j &lt; cols; j++) + printf(&quot;%d &quot;, c[i][j]); + printf(&quot;\n&quot;); + } + + return 0; +}</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('APC-S-009.c', 'APC-S-009.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-009.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-009-c', 'APC-S-009.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-009.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-009.c</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/tuition-c/APC-S-009.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-009.c" 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-tuition-c-APC-S-009-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the upper and lower triangular matrix. */ +/* Author: Amit Dutta, Date: 18-11-2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, rows, cols; + printf(&quot;\nEnter the number of rows and columns : &quot;); + scanf(&quot;%d %d&quot;, &amp;rows, &amp;cols); + + if (rows != cols) + { + printf(&quot;Triangular matrix definitions only apply to square matrices (rows == columns).\n&quot;); + return 1; + } + + int matrix[rows][cols]; + + printf(&quot;Enter the elements of matrix (%d x %d): \n&quot;, rows, cols); + for (i = 0; i &lt; rows; i++) + for (j = 0; j &lt; cols; j++) + { + printf(&quot;Position %d%d: &quot;, i, j); + scanf(&quot;%d&quot;, &amp;matrix[i][j]); + } + printf(&quot;\nMatrix: \n&quot;); + for (i = 0; i &lt; rows; i++) + { + for (j = 0; j &lt; cols; j++) + printf(&quot;%d &quot;, matrix[i][j]); + printf(&quot;\n&quot;); + } + + printf(&quot;\nUpper triangular of the Matrix: \n&quot;); + for (i = 0; i &lt; rows; i++) + { + for (j = 0; j &lt; cols; j++) + { + if (j &gt;= i) + printf(&quot;%d &quot;, matrix[i][j]); + else + printf(&quot;~ &quot;); + } + printf(&quot;\n&quot;); + } + + printf(&quot;\nLower triangular of the Matrix: \n&quot;); + for (i = 0; i &lt; rows; i++) + { + for (j = 0; j &lt; cols; j++) + { + if (j &lt;= i) + printf(&quot;%d &quot;, matrix[i][j]); + else + printf(&quot;~ &quot;); + } + printf(&quot;\n&quot;); + } + + return 0; +}</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('APC-S-010.c', 'APC-S-010.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-010.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-010-c', 'APC-S-010.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-010.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-010.c</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/tuition-c/APC-S-010.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-010.c" 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-tuition-c-APC-S-010-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input a new element at a specific position of an array. + a[] = {4, 5, 2, 10, 6, 9, 8}, newItem = 7, position = 3 +*/ +/* Author: Amit Dutta, Date: 18-11-2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int a[8] = {4, 5, 2, 10, 6, 9, 8}; + int i; + + printf(&quot;Elemnts of the array: &quot;); + for (i = 0; i &lt;= 6; i++) + printf(&quot;%d &quot;, a[i]); + + printf(&quot;\nMethod 1: &quot;); + for (i = 7; i &gt;= 4; i--) + a[i] = a[i - 1]; + a[3] = 7; + for (i = 0; i &lt;= 7; i++) + printf(&quot;%d &quot;, a[i]); + + // another method + printf(&quot;\nMethod 2: &quot;); + int b[8] = {4, 5, 2, 10, 6, 9, 8}; + int temp1 = 7; + for (i = 3; i &lt;= 7; i++) + { + int temp2 = b[i]; + b[i] = temp1; + temp1 = temp2; + } + for (i = 0; i &lt;= 7; i++) + printf(&quot;%d &quot;, b[i]); + + return 0; +}</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('APC-S-011.c', 'APC-S-011.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-011.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-011-c', 'APC-S-011.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-011.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-011.c</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/tuition-c/APC-S-011.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-011.c" 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-tuition-c-APC-S-011-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Linear search */ +/* Author: Amit Dutta, Date: 19-11-2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int elementCount, i, keyElement; + + printf(&quot;Enter the number of element you want to add: &quot;); + scanf(&quot;%d&quot;, &amp;elementCount); + + int elements[elementCount]; + + for (i = 0; i &lt; elementCount; i++) + { + printf(&quot;Enter Element %d: &quot;, i + 1); + scanf(&quot;%d&quot;, &amp;elements[i]); + } + + printf(&quot;\nEnter the Key Element you want to search: &quot;); + scanf(&quot;%d&quot;, &amp;keyElement); + for (i = 0; i &lt; elementCount; i++) + if (elements[i] == keyElement) + { + printf(&quot;\nKey Element %d is found in %d position.&quot;, keyElement, i); + return 0; + } + printf(&quot;\nKey Element %d is not found.&quot;, keyElement); + return 0; +}</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('APC-S-012.c', 'APC-S-012.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-012.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-012-c', 'APC-S-012.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-012.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-012.c</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/tuition-c/APC-S-012.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-012.c" 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-tuition-c-APC-S-012-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check if a matrix is a sparx matrix. */ +/* Author: Amit Dutta, Date: 19-11-2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, row, col, count = 0; + + printf(&quot;Enter the number of rows and columns in the matrix: &quot;); + scanf(&quot;%d %d&quot;, &amp;row, &amp;col); + + int matrix[row][col]; + + for (i = 0; i &lt; row; i++) + for (j = 0; j &lt; col; j++) + { + printf(&quot;Postion %d%d: &quot;, i, j); + scanf(&quot;%d&quot;, &amp;matrix[i][j]); + if (matrix[i][j] == 0) + count++; + } + + printf(&quot;\nEntered Matrix: \n&quot;); + for (i = 0; i &lt; row; i++) + { + for (j = 0; j &lt; col; j++) + printf(&quot;%d &quot;, matrix[i][j]); + printf(&quot;\n&quot;); + } + + if (count &gt; (row * col) / 2) + printf(&quot;\nEntered matrix is a Sparx Matrix.&quot;); + else + printf(&quot;\nEntered matrix is not a Sparx Matrix&quot;); + return 0; +}</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('APC-S-013.c', 'APC-S-013.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-S-013.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-S-013-c', 'APC-S-013.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-013.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-S-013.c</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/tuition-c/APC-S-013.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-013.c" 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-tuition-c-APC-S-013-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a fuction to calculate the average of an array */ +/* Author: Amit Dutta, Date: 26-11-2025 */ + +#include &lt;stdio.h&gt; + +double average(int []); + +int main() +{ + int marks[10], i; + printf(&quot;\nEnter 10 numbers: \n&quot;); + for (i = 0; i &lt;= 9; i++) + { + printf(&quot;Enter number %d: &quot;, i + 1); + scanf(&quot;%d&quot;, &amp;marks[i]); + } + printf(&quot;\nAverage = %g&quot;, average(marks)); + return 0; +} + +double average(int marks[10]) +{ + int sum = 0; + for (int i = 0; i &lt;= 9; i++) + sum += marks[i]; + return sum / 10.0; +} +</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('APC-SPS-001.c', 'APC-SPS-001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-001-c', 'APC-SPS-001.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-001.c</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/tuition-c/APC-SPS-001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-001.c" 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-tuition-c-APC-SPS-001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +// WAP to perform arithmatic operation on integer data + +#include&lt;stdio.h&gt; +int main() { + int a, b, sum, sub, multi, div, mod; + printf(&quot;Enter 1st number : &quot;); + scanf(&quot;%d&quot;, &amp;a); + printf(&quot;Enter 2nd number : &quot;); + scanf(&quot;%d&quot;, &amp;b); + sum = a + b; + sub = a - b; + multi = a * b; + div = a / b; + mod = a % b; + printf(&quot;\nSum = %d&quot;, sum); + printf(&quot;\nSubtraction = %d&quot;, sub); + printf(&quot;\nMultiplication = %d&quot;, multi); + printf(&quot;\nDivision = %d&quot;, div); + printf(&quot;\nModulas = %d&quot;, div); + return 0; +} +</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('APC-SPS-002.c', 'APC-SPS-002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-002-c', 'APC-SPS-002.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-002.c</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/tuition-c/APC-SPS-002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-002.c" 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-tuition-c-APC-SPS-002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to swap two integers. Display both numbers +before and after swap */ + +#include&lt;stdio.h&gt; +int main() { + int a = 10, b = 20, temp; + printf(&quot;Before swap A : %d, B : %d&quot;, a, b); + temp = a; + a = b; + b = temp; + printf(&quot;\nAfter swap A : %d, B : %d&quot;, a, b); + return 0; +} +</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('APC-SPS-003.c', 'APC-SPS-003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-003-c', 'APC-SPS-003.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-003.c</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/tuition-c/APC-SPS-003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-003.c" 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-tuition-c-APC-SPS-003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Bitwise AND &#x27;&amp;&#x27; */ + +#include&lt;stdio.h&gt; +int main() { + unsigned int a = 4, b = 5, c = 6; + unsigned int x, y; + x = a &amp; b; + y = b &amp; c; + printf(&quot;x = %u y = %u&quot;, x, y); + return 0; +} +</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('APC-SPS-004.c', 'APC-SPS-004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-004-c', 'APC-SPS-004.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-004.c</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/tuition-c/APC-SPS-004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-004.c" 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-tuition-c-APC-SPS-004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +#include&lt;stdio.h&gt; +int main() { + int x = 25, y = 19, z; + z = x - y; + z = z &amp; x ; + printf(&quot;Z = %d&quot;, z); + return 0; +} +</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('APC-SPS-005.c', 'APC-SPS-005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-005-c', 'APC-SPS-005.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-005.c</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/tuition-c/APC-SPS-005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-005.c" 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-tuition-c-APC-SPS-005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Bitwise OR &#x27;|&#x27; */ + +#include&lt;stdio.h&gt; +int main() { + int x = 12, y = 14, z = 10, res; + x++; + z++; + x = x + y + z; + res = x | y; + z = res | z; + printf(&quot;x = %d y = %d z = %d res = %d&quot;, x, y, z, res); + return 0; +} +</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('APC-SPS-006.c', 'APC-SPS-006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-006-c', 'APC-SPS-006.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-006.c</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/tuition-c/APC-SPS-006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-006.c" 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-tuition-c-APC-SPS-006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Bitwise NOT &#x27;~&#x27; */ + +#include&lt;stdio.h&gt; +int main() { + int x = 12, y = 15, z = 21; + int res, res1, res2; + res = x &gt; 10; + res1 = ~res; + res2 = ~x; + printf(&quot;REs = %d, Res1 = %d, Res2 = %d&quot;, res, res1, res2); + return 0; +} +</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('APC-SPS-007.c', 'APC-SPS-007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-007-c', 'APC-SPS-007.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-007.c</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/tuition-c/APC-SPS-007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-007.c" 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-tuition-c-APC-SPS-007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to check a number is even or odd using bitwise operator */ + +#include&lt;stdio.h&gt; +int main() { + int x, res = 1; + printf(&quot;Enter a number : &quot;); + scanf(&quot;%d&quot;, &amp;x); + res = res &amp; x; + if (res == 0) { + printf(&quot;\nInput %d is a even number.&quot;, x); + } + else { + printf(&quot;\nInput %d is a odd number.&quot;, x); + } + return 0; +} +</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('APC-SPS-008.c', 'APC-SPS-008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/APC-SPS-008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-APC-SPS-008-c', 'APC-SPS-008.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">APC-SPS-008.c</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/tuition-c/APC-SPS-008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-008.c" 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-tuition-c-APC-SPS-008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate area of circle by accepting radius as input */ +/* Author : Amit Dutta, Date : 15th September, 2025 */ + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + double r, area; + printf(&quot;Enter the radius of circle : &quot;); + scanf(&quot;%lf&quot;, &amp;r); + area = M_PI * r * r; + printf(&quot;\nArea : %lf&quot;, area); + return 0; +} +</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('P001.c', 'P001.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P001.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P001-c', 'P001.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P001.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P001.c</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/tuition-c/P001.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P001.c" 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-tuition-c-P001-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +//sample code +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + printf(&quot;Hello world&quot;); + return 0; +} +</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('P002.c', 'P002.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P002.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P002-c', 'P002.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P002.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P002.c</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/tuition-c/P002.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P002.c" 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-tuition-c-P002-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +//sample code with a new line charecter +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + printf(&quot;Hello\nworld&quot;); + return 0; +} +</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('P003.c', 'P003.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P003.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P003-c', 'P003.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P003.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P003.c</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/tuition-c/P003.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P003.c" 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-tuition-c-P003-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +//WAP to perform addtion and multiplication of two integer numbers +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + int a, b, sum, multi; + printf(&quot;Enter the 1st number : &quot;); + scanf(&quot;%d&quot;,&amp;a); + printf(&quot;Enter the 2nd number : &quot;); + scanf(&quot;%d&quot;,&amp;b); + sum = a + b; + multi = a * b; + printf(&quot;\nSum = %d&quot; + &quot;\nMultiplication = %d&quot;,sum,multi); + return 0; +} +</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('P004.c', 'P004.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P004.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P004-c', 'P004.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P004.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P004.c</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/tuition-c/P004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P004.c" 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-tuition-c-P004-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to find and display the value of given expression : +((x+3)/4) - ((2x+4)/3) taking the value of x = 5 */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + double x =5, result; + result = ((x + 3) / 4) - ((2 * x + 4) / 3); + printf(&quot;Result = %lf&quot;,result); + return 0; +} +</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('P005.c', 'P005.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P005.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P005-c', 'P005.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P005.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P005.c</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/tuition-c/P005.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P005.c" 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-tuition-c-P005-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A person is paid Rs. 455 for each day he works and fined +Rs. 150 for each day he remains absent. WAP to calculate his +monthly income taking the number of days present as input. */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + int daily_wage = 455, fine = 150, present, absent, income; + printf(&quot;No of days present : &quot;); + scanf(&quot;%d&quot;, &amp;present); + absent = 30 - present; + income = (present * 455) - (absent * 150); + printf(&quot;\nIncome : %d&quot;,income); + return 0; +} +</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('P006.c', 'P006.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P006.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P006-c', 'P006.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P006.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P006.c</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/tuition-c/P006.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P006.c" 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-tuition-c-P006-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* The normal temperature of human body +is 98.6 Degree Fahrenheit. WAP to convert the temperature +to Degree Celcius and display the output. */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + double f = 98.6, c; + c = ((f - 32) * 5) / 9; + printf(&quot;Temperature in Celcius is : %lf&quot;,c); + return 0; +} +</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('P007.c', 'P007.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P007.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P007-c', 'P007.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P007.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P007.c</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/tuition-c/P007.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P007.c" 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-tuition-c-P007-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A shopkeeper offers 10% discount on printed +price of a digital camera. However a customer has +to pay 6% GST on the remaining amount. WAP to +calculate and display the amount to paid by the +customer, taking the printed price as input. */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + double mrp, final_price, temp; + printf(&quot;Enter the printed price : &quot;); + scanf(&quot;%lf&quot;, &amp;mrp); + temp = mrp * 0.90; + final_price = temp * 1.06; + printf(&quot;\nCustomer have to pay : %lf&quot;, final_price); + return 0; +} +</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('P008.c', 'P008.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P008.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P008-c', 'P008.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P008.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P008.c</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/tuition-c/P008.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P008.c" 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-tuition-c-P008-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* A shopkeeper offers 30% discount on purchasing an +item whereas the other shopkeeper offers 2 successive +discount of 20% and 10% for purchasing the same item. +WAP to caompute and display the discounted price of the +item by taking the price as input. */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + double mrp, shop1, shop2, temp; + printf(&quot;Enter the price : &quot;); + scanf(&quot;%lf&quot;, &amp;mrp); + shop1 = mrp * 0.70; + temp = mrp * 0.80; + shop2 = temp * 0.90; + printf(&quot;\nShopkeeper 1 price : %lf&quot; + &quot;\nShopkeeper 2 price : %lf&quot;,shop1,shop2); + return 0; +} +</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('P009.c', 'P009.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P009.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P009-c', 'P009.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P009.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P009.c</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/tuition-c/P009.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P009.c" 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-tuition-c-P009-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate gross and net salary +by accepting basic salary as input. +IMP : DA = 30% of Basic Pay + HRA = 20% of Basic Pay + PF = 12.5% of Basic Pay + Gross Salary = Basic Pay + DA + HRA + Net Salary = Gross Salary - PF +*/ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + double bs, da, hra, pf, gs, ns; + printf(&quot;Enter the Basic Salary : &quot;); + scanf(&quot;%lf&quot;, &amp;bs); + da = bs * 0.3; + hra = bs * 0.2; + pf = bs * 0.125; + gs = bs + da + hra; + ns = gs - pf; + printf(&quot;\nGross Salary : %lf&quot; + &quot;\nNet Salary : %lf&quot;, gs, ns); + return 0; +} +</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('P010.c', 'P010.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P010.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P010-c', 'P010.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P010.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P010.c</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/tuition-c/P010.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P010.c" 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-tuition-c-P010-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to find and display the difference +between compound Interest and Simple Interest. +Take principle amount as input. +Hint : si = (p * r * t) / 100 + a = p * ((1 + (r / 100)) ^ t) + ci = a - p +*/ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + double p, r, t, si, a, ci, dif; + printf(&quot;Enter the principle amount, rate of interest, time in year : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;p, &amp;r, &amp;t); + si = (p * r * t) / 100; + a = p * pow((1 + (r / 100)), t); + ci = a - p; + dif = ci - si; + printf(&quot;\nSimple Interest : %lf&quot; + &quot;\nCompound Interest : %lf&quot; + &quot;\nInterest Difference : %lf&quot;, si, ci, dif); + return 0; +} +</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('P011.c', 'P011.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P011.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P011-c', 'P011.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P011.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P011.c</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/tuition-c/P011.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P011.c" 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-tuition-c-P011-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* The time period of a simple pendulam is +given by the formula : + t = 2 * pi * square_root(l / g) +WAP to calculate T take length(L) and gravity +as input +*/ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + double l, g, t; + printf(&quot;Enter the Length and Gravity measures : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;l, &amp;g); + t = 2 * M_PI * sqrt(l / g); + // using M_PI variable for PI value from math.h header file + printf(&quot;\nTime Period : %lf&quot;, t); + return 0; +} +</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('P012.c', 'P012.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P012.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P012-c', 'P012.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P012.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P012.c</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/tuition-c/P012.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P012.c" 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-tuition-c-P012-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to swap two integer variable without +using third variable */ +// using Approch Mode : simple, slow, time consuming +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + int a = 4, b = 6; + printf(&quot;Before Swap : A = %d, B = %d&quot;, a, b); + a = a + b; + b = a - b; + a = a - b; + printf(&quot;\nAfter Swap : A = %d, B = %d&quot;, a, b); + return 0; +} +</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('P013.c', 'P013.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P013.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P013-c', 'P013.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P013.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P013.c</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/tuition-c/P013.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P013.c" 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-tuition-c-P013-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to swap two integer variable without +using third variable */ +// using Approch Mode : complex, fast, less time consumimg +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + int a = 4, b = 6; + printf(&quot;Before Swap : A = %d, B = %d&quot;, a, b); + a = a ^ b; + b = a ^ b; + a = a ^ b; + printf(&quot;\nAfter Swap : A = %d, B = %d&quot;, a, b); + return 0; +} +</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('P014.c', 'P014.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P014.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P014-c', 'P014.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P014.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P014.c</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/tuition-c/P014.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P014.c" 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-tuition-c-P014-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to accept the diagonal of +square. Find and display the area and +perimeter of the square. */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + double d, side, area, per; + printf(&quot;Enter the diagonal : &quot;); + scanf(&quot;%lf&quot;, &amp;d); + side = d / sqrt (2); + area = side * side; + per = 4 * side; + printf(&quot;\nArea of the Square : %lf&quot; + &quot;\nPerimeter of the Square : %lf&quot;, area, per); + return 0; +} +</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('P015.c', 'P015.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P015.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P015-c', 'P015.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P015.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P015.c</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/tuition-c/P015.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P015.c" 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-tuition-c-P015-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/*WAP to accept number of days and +display it after converting into +number of years, months and days */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +int main() { + int day, month, year, temp; + printf(&quot;Enter the number of days : &quot;); + scanf(&quot;%d&quot;, &amp;day); + temp = day; + year = day / 365; + day = day % 365; + month = day / 30; + day = day % 30; + printf(&quot;\n%d Days = %d Years %d Months %d Days&quot;, temp, year, month, day); + return 0; +} +</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('P016.c', 'P016.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P016.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P016-c', 'P016.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P016.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P016.c</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/tuition-c/P016.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P016.c" 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-tuition-c-P016-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate and display radius of a +circle by taking the area as input */ +// Author - Amit Dutta, Date - Unknown + +#include&lt;stdio.h&gt; +#include&lt;math.h&gt; +int main() { + double area, r; + printf(&quot;Enter the area of a circle : &quot;); + scanf(&quot;%lf&quot;, &amp;area); + r = sqrt((7 * area) / 22); + printf(&quot;\nRadius : %lf&quot;, r); + return 0; +} +</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('P017.c', 'P017.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P017.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P017-c', 'P017.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P017.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P017.c</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/tuition-c/P017.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P017.c" 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-tuition-c-P017-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Find maximum between three number. */ +// Author - Amit Dutta, Date - Unknown + +#include &lt;stdio.h&gt; +int main() +{ + int a, b, c, max; + printf(&quot;Enter the value for a, b, c : &quot;); + scanf(&quot;%d %d %d&quot;, &amp;a, &amp;b, &amp;c); + max = a; + if (max &lt; b) + max = b; + if (max &lt; c) + max = c; + printf(&quot;Maximum : %d&quot;, max); + return 0; +}</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('P018.c', 'P018.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P018.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P018-c', 'P018.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P018.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P018.c</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/tuition-c/P018.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P018.c" 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-tuition-c-P018-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input the cost price and selling price and +calculate profit, profit percentage, loss percentage or +display the manage nither profit nor loss. */ +// Author - Amit Dutta, Date - Unknown + +#include &lt;stdio.h&gt; +int main() +{ + double cost, sell, pro, prop, loss, lossp; + printf(&quot;Enter the cost and selling price : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;cost, &amp;sell); + if (sell &gt; cost) + { + pro = sell - cost; + prop = (pro / cost) * 100; + printf(&quot;Profit : RS %g, Profit Percentage : %g&quot;, pro, prop); + } + else if (sell &lt; cost) + { + loss = cost - sell; + lossp = (loss / cost) * 100; + printf(&quot;Loss : RS %g, Loss Percentage : %g&quot;, loss, lossp); + } + else + printf(&quot;Neither loss nor Profit.&quot;); + return 0; +}</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('P019.c', 'P019.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P019.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P019-c', 'P019.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P019.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P019.c</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/tuition-c/P019.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P019.c" 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-tuition-c-P019-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input the distance covered and calculate +the amount to be paid by the passanger. + Distance Rate + =&lt;5KM RS 90 + next 10KM RS 20/KM + next 10KM RS 10/KM + more than 25KM RS 9/KM +*/ +// Author - Amit Dutta, Date - Unknown + +#include &lt;stdio.h&gt; +int main() +{ + double dis, amt; + printf(&quot;Enter the distance : &quot;); + scanf(&quot;%lf&quot;, &amp;dis); + if (dis &lt;= 5.0) + amt = 90.0; + else if (dis &gt; 5.0 &amp;&amp; dis &lt;= 15.0) + amt = 90.0 + (dis - 5.0) * 20; + else if (dis &gt; 15.0 &amp;&amp; dis &lt;= 25.0) + amt = 90.0 + 200.0 + (dis - 15.0) * 10; + else if (dis &gt; 25.0) + amt = 90.0 + 200.0 + 100.0 + (dis - 25.0) * 9; + printf(&quot;\nAmount to be paid : %g&quot;, amt); + return 0; +}</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('P020.c', 'P020.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P020.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P020-c', 'P020.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P020.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P020.c</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/tuition-c/P020.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P020.c" 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-tuition-c-P020-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate and display the maturity amount +taking the sum and number of days as input. + No. of Days Rate of Interest + Upto 180 days 5.5 % + 181 to 364 days 7.5 % + exact 365 days 9.0 % + more than 365 days 8.5 % +*/ +// Author - Amit Dutta, Date - Unknown + +#include &lt;stdio.h&gt; +int main() +{ + double nod, amt, s, i; + printf(&quot;Enter the amount and the time in days : &quot;); + scanf(&quot;%lf %lf&quot;, &amp;s, &amp;nod); + if (nod &lt;= 180) + i = (s * 5.5 * (nod / 365)) / 100; + else if (nod &gt; 180.0 &amp;&amp; nod &lt;= 364.0) + i = (s * 7.5 * (nod / 365)) / 100; + else if (nod == 365.0) + i = (s * 9.0 * 1) / 100; + else if (nod &gt; 365.0) + i = (s * 8.5 * (nod / 365)) / 100; + amt = s + i; + printf(&quot;Amount to be paid : %g&quot;, amt); + return 0; +}</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('P021.c', 'P021.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P021.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P021-c', 'P021.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P021.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P021.c</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/tuition-c/P021.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P021.c" 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-tuition-c-P021-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input a positive number and check if it is a perfect +square number or not. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +int main() +{ + int n, temp; + double sr; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + sr = sqrt(n); + temp = (int)sr; + if (temp * temp == n) + printf(&quot;\nThis is a perfect square.&quot;); + else + printf(&quot;\nThis is not a perfect square.&quot;); + return 0; +}</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('P022.c', 'P022.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P022.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P022-c', 'P022.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P022.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P022.c</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/tuition-c/P022.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P022.c" 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-tuition-c-P022-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to find out smallest of three numbers without using if_else block. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. + +#include &lt;stdio.h&gt; +int main() +{ + int a, b, c, min; + printf(&quot;Enter three number : &quot;); + scanf(&quot;%d %d %d&quot;, &amp;a, &amp;b, &amp;c); + min = (a &lt; b &amp;&amp; a &lt; c) ? a : (b &lt; a &amp;&amp; b &lt; c) ? b + : c; + printf(&quot;Minimum = %d&quot;, min); + return 0; +}</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('P023.c', 'P023.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P023.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P023-c', 'P023.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P023.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P023.c</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/tuition-c/P023.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P023.c" 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-tuition-c-P023-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input the total cost and compute the amount to be paid +by the customer. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. + +#include &lt;stdio.h&gt; +int main() +{ + double cost, amt; + printf(&quot;Enter the total cost : &quot;); + scanf(&quot;%lf&quot;, &amp;cost); + if (cost &lt;= 2000) + amt = cost * 0.94; + else if (cost &gt; 2000 &amp;&amp; cost &lt;= 5000) + amt = cost * 0.9; + else if (cost &gt; 5000 &amp;&amp; cost &lt;= 10000) + amt = cost * 0.85; + else if (cost &gt; 10000) + amt = cost * 0.8; + printf(&quot;\nAmount to be paid : %g&quot;, amt); + return 0; +}</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('P024.c', 'P024.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P024.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P024-c', 'P024.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P024.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P024.c</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/tuition-c/P024.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P024.c" 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-tuition-c-P024-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to check whether a year is leapyear or not. */ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. + +#include &lt;stdio.h&gt; +int main() +{ + int year; + printf(&quot;Enter the year : &quot;); + scanf(&quot;%d&quot;, &amp;year); + if (year % 4 == 0 &amp;&amp; year % 100 != 0) + printf(&quot;\nYear %d is a leapyear.&quot;, year); + else if (year % 400 == 0) + printf(&quot;\nYear %d is a leapyear (Century).&quot;, year); + else + printf(&quot;\nYear %d is not a leapyear.&quot;, year); + return 0; +}</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('P025.c', 'P025.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P025.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P025-c', 'P025.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P025.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P025.c</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/tuition-c/P025.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P025.c" 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-tuition-c-P025-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input the electricity unit consumed and calculate the total +bill amount according to the given condition : + for 1st 50 unit Rs. 0.50 per unit + next 100 unit Rs. 0.75 per unit + next 100 unit Rs. 1.20 per unit + above 250 unit Rs. 1.50 per unit +And additional charge of 20 percent is added to the bill. +*/ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. + +#include &lt;stdio.h&gt; +int main() +{ + double unit, amt; + printf(&quot;Enter the electricity consp(unit) : &quot;); + scanf(&quot;%lf&quot;, &amp;amt); + if (unit &lt;= 50) + amt = unit * 0.50; + else if (unit &gt; 50 &amp;&amp; unit &lt;= 50) + amt = 25 + ((unit - 50) * 0.75); + else if (unit &gt; 150 &amp;&amp; unit &lt;= 250) + amt = 25 + 75 + ((unit - 150) * 1.20); + else if (unit &gt; 250) + amt = 25 + 75 + 120 + ((unit - 250) * 1.50); + amt = amt * 1.20; + printf(&quot;\nAmount to be paid : %g&quot;, amt); + return 0; +}</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('P026.c', 'P026.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P026.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P026-c', 'P026.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P026.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P026.c</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/tuition-c/P026.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P026.c" 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-tuition-c-P026-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input sum (p), rate of interest (r), time (t) and type of interest +(&#x27;s&#x27; for simple interest amd &#x27;c&#x27; for compound interest). Calculate and display +the interest earned + si = (p * r * t) / 100 + compoundInterest = p * ((1 + r / 100)^t - 1) +*/ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;ctype.h&gt; +int main() +{ + double principalAmount, rateOfInterest, timePeriod, simpleInterest, compoundInterest; + char mode; + printf(&quot;Enter the principle amount, Rate of interest, Time : &quot;); + scanf(&quot;%lf %lf %lf&quot;, &amp;principalAmount, &amp;rateOfInterest, &amp;timePeriod); + printf(&quot;\nEnter the mode (&#x27;s&#x27; : simple interest, &#x27;c&#x27; : compound interest) : &quot;); + scanf(&quot; %c&quot;, &amp;mode); + mode = tolower(mode); + switch (mode) + { + case &#x27;s&#x27;: + simpleInterest = (principalAmount * rateOfInterest * timePeriod) / 100; + printf(&quot;\nSimple Interest : %g&quot;, simpleInterest); + break; + case &#x27;c&#x27;: + compoundInterest = principalAmount * (pow((1 + rateOfInterest / 100), timePeriod) - 1); + printf(&quot;\nCompound Interest : %g&quot;, compoundInterest); + break; + default: + printf(&quot;\nInvalid Input&quot;); + return 1; + } + return 0; +}</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('P027.c', 'P027.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P027.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P027-c', 'P027.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P027.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P027.c</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/tuition-c/P027.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P027.c" 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-tuition-c-P027-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Purchase Discount on Discount on + Amount Laptop Desktop + -------- ----------- ----------- + Upto 20k 3.0% 5.0% + 20001 - 50k 5.0% 7.5% + 50001 - 75k 7.5% 10.5% + more than 75k 10.0% 15.0% +WAP to input amount of purchase and type of purchase (&#x27;L&#x27; : laptop, &#x27;D&#x27; : desktop) +and display the discount amount and the discounted price (Net Amount). +*/ +/* Author - Amit Dutta, Date - 8th OCT, 2025 */ +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. + +#include &lt;stdio.h&gt; +#include &lt;ctype.h&gt; +int main() +{ + double principal_amount, desktop_discount, laptop_discount, discount_amount, discounted_price; + char choice; + printf(&quot;Enter the purchase amount : &quot;); + scanf(&quot;%lf&quot;, &amp;principal_amount); + printf(&quot;Type of purchase (&#x27;L&#x27; : Laptop, &#x27;D&#x27; : Desktop) : &quot;); + scanf(&quot; %c&quot;, &amp;choice); + choice = toupper(choice); + if (principal_amount &lt;= 20000) + { + laptop_discount = 0.03; + desktop_discount = 0.05; + } + else if (principal_amount &gt; 20000 &amp;&amp; principal_amount &lt;= 50000) + { + laptop_discount = 0.05; + desktop_discount = 0.075; + } + else if (principal_amount &gt; 50000 &amp;&amp; principal_amount &lt;= 75000) + { + laptop_discount = 0.075; + desktop_discount = 0.105; + } + else if (principal_amount &gt; 75000) + { + laptop_discount = 0.1; + desktop_discount = 0.15; + } + switch (choice) + { + case &#x27;L&#x27;: + discount_amount = principal_amount * laptop_discount; + discounted_price = principal_amount - discount_amount; + printf(&quot;\nDiscount Amount : %g&quot; + &quot;\nDiscounted Price : %g&quot;, + discount_amount, discounted_price); + break; + case &#x27;D&#x27;: + discount_amount = principal_amount * desktop_discount; + discounted_price = principal_amount - discount_amount; + printf(&quot;\nDiscount Amount : %g&quot; + &quot;\nDiscounted Price : %g&quot;, + discount_amount, discounted_price); + break; + default: + printf(&quot;\nInvalid Input.&quot;); + return 1; + } + return 0; +}</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('P028.c', 'P028.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P028.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P028-c', 'P028.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P028.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P028.c</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/tuition-c/P028.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P028.c" 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-tuition-c-P028-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate factorial of a number */ +/* Author - Amit Dutta, Date - 11th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int i = 1, num, fact = 1; + printf(&quot;Enter the number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + return 1; + } + if (num == 0) + { + printf(&quot;\nFactorial of 0 : 1&quot;); + return 0; + } + if (num &lt; 0) + { + printf(&quot;\nFactorial of %d : UNDEFINED&quot;, num); + return 0; + } + while (i &lt;= num) + { + fact = fact * i; + i++; + } + printf(&quot;Factorial of %d : %d&quot;, num, fact); + return 0; +}</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('P029.c', 'P029.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P029.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P029-c', 'P029.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P029.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P029.c</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/tuition-c/P029.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P029.c" 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-tuition-c-P029-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to perform addition of first n natural numbers. sum = 1 + 2 + 3 + ... */ +/* Author - Amit Dutta, Date - 11th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, i = 0, result = 0; + printf(&quot;Enter the value for n : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nPlease enter a number.&quot;); + return 1; + } + if (num &lt; 1) + { + printf(&quot;\nPlease enter a positive number.&quot;); + return 1; + } + while (i &lt;= num) + { + result = result + i; + i++; + } + printf(&quot;\nResult : %d&quot;, result); + return 0; +}</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('P030.c', 'P030.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P030.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P030-c', 'P030.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P030.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P030.c</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/tuition-c/P030.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P030.c" 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-tuition-c-P030-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Display the first 15 terms of the series. */ +/* Author - Amit Dutta, Date - 11th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int i, r; + + // 3, 6, 9, 12, ... + { + i = 3, r = 0; + printf(&quot;Series 1 (3, 6, 9, 12, ...) :&quot;); + while (i &lt;= 15) + { + r = r + 3; + printf(&quot; %d&quot;, r); + i++; + } + } + + // 1, 4, 9, 16, ... + { + i = 1; + printf(&quot;\nSeries 2 (1, 4, 9, 16, ...) :&quot;); + while (i &lt;= 15) + { + printf(&quot; %d&quot;, i * i); + i++; + } + } + + // 4, 8, 16, 32, ... + { + i = 1, r = 2; + printf(&quot;\nSeries 3 (4, 8, 16, 32, ...) :&quot;); + while (i &lt;= 15) + { + r = r * 2; + printf(&quot; %d&quot;, r); + i++; + } + } + + // 0, 7, 26, ... + { + i = 1, r; + printf(&quot;\nSeries 4 (0, 7, 26, ...) :&quot;); + while (i &lt;= 15) + { + r = (int)pow(i, 3) - 1; + printf(&quot; %d&quot;, r); + i++; + } + } + + return 0; +} +</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('P031.c', 'P031.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P031.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P031-c', 'P031.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P031.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P031.c</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/tuition-c/P031.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P031.c" 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-tuition-c-P031-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Find the sum of the series */ +/* Author - Amit Dutta, Date - 11th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + double a, res, n; + int i; + + // s = (a ^ 2) + (a ^ 2 / 2) + (a ^ 2 / 3) + ... + (a ^ 2 / 10) + { + res = 0, i = 1; + printf(&quot;--- s = (a ^ 2) + (a ^ 2 / 2) + (a ^ 2 / 3) + ... + (a ^ 2 / 10) ---&quot;); + printf(&quot;\nEnter the number : &quot;); + scanf(&quot;%lf&quot;, &amp;a); + while (i &lt;= 10) + { + res = res + ((a * a) / i); + i++; + } + printf(&quot;S = %g&quot;, res); + } + + // s = 1 + (2 ^ 2 / a) + (3 ^ 3 / a ^ 2) + ... + n + { + res = 0, i = 0; + printf(&quot;\n--- // s = 1 + (2 ^ 2 / a) + (3 ^ 3 / a ^ 2) + ... + n ---&quot;); + printf(&quot;\nEnter the value for a and n : &quot;); + scanf(&quot; %lf %lf&quot;, &amp;a, &amp;n); + while (i &lt;= n - 1) + { + res = res + (pow(i + 1, i + 1) / pow(a, i)); + i++; + } + printf(&quot;S = %g&quot;, res); + } + + return 0; +}</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('P032.c', 'P032.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P032.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P032-c', 'P032.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P032.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P032.c</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/tuition-c/P032.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P032.c" 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-tuition-c-P032-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input a number and check whether it is a Niven number +or not. (When a number is divisible by its sum of digit) e.g. : n = 126*/ +/* Author - Amit Dutta, Date - 11th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int n, temp, sod = 0; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + temp = n; + while (temp &gt; 0) + { + sod = sod + (temp % 10); + temp = temp / 10; + } + if (n % sod == 0) + printf(&quot;\nIt is Niven number.&quot;); + else + printf(&quot;\nIt is not a Niven number.&quot;); + return 0; +}</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('P033.c', 'P033.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P033.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P033-c', 'P033.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P033.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P033.c</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/tuition-c/P033.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P033.c" 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-tuition-c-P033-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to calculate the sum of even digits and odd digits. Number will be provided by user. */ +/* Author - Amit Dutta, Date - 18th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int inp, odd = 0, even = 0, temp; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;inp); + temp = inp; + while (temp &gt; 0) + { + if ((temp % 10) % 2 == 0) + even += temp % 10; + else + odd += temp % 10; + temp /= 10; + } + printf(&quot;\nSum of even : %d&quot; + &quot;\nSum of odd : %d&quot;, + even, odd); + return 0; +}</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('P034.c', 'P034.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P034.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P034-c', 'P034.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P034.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P034.c</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/tuition-c/P034.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P034.c" 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-tuition-c-P034-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Get sum of even position digit and odd position digit */ +/* Counting starts from the rightmost digit as position 1 (Odd). */ +/* Author - Amit Dutta, Date - 18th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int inp, temp, index = 1, even = 0, odd = 0; + printf(&quot;Enter the numebr : &quot;); + scanf(&quot;%d&quot;, &amp;inp); + temp = inp; + while (temp &gt; 0) + { + if (index % 2 == 0) + even += temp % 10; + else + odd += temp % 10; + temp /= 10; + index++; + } + printf(&quot;\nSum of even position digits : %d&quot; + &quot;\nSum of odd position digits : %d&quot;, + even, odd); + return 0; +}</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('P035.c', 'P035.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P035.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P035-c', 'P035.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P035.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P035.c</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/tuition-c/P035.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P035.c" 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-tuition-c-P035-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to input an int number and display the product of the successors +of even digits of the number entered by user. */ +/* Author - Amit Dutta, Date - 18th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;stdbool.h&gt; +int main() +{ + int n, res = 1, temp; + bool status = false; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + temp = n; + while (temp &gt; 0) + { + if ((temp % 10) % 2 == 0) + { + res *= (temp % 10) + 1; + status = true; + } + temp /= 10; + } + if (!status) + printf(&quot;\nThere is no even digits.&quot;); + else + printf(&quot;\nThe product of the successors of even digits of the number %d is : %d&quot;, n, res); + return 0; +}</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('P036.c', 'P036.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P036.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P036-c', 'P036.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P036.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P036.c</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/tuition-c/P036.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P036.c" 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-tuition-c-P036-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* sum = a + (a^2)/2 + (a^3)/3 + ... + (a^n)/n */ +/* Author - Amit Dutta, Date - 18th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + double a, sum = 0; + int n, i; + printf(&quot;Enter value for a and n : &quot;); + scanf(&quot;%lf %d&quot;, &amp;a, &amp;n); + for (i = 1; i &lt;= n; i++) + sum += pow(a, i) / i; + printf(&quot;\nSum = %g&quot;, sum); + return 0; +}</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('P037.c', 'P037.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P037.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P037-c', 'P037.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P037.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P037.c</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/tuition-c/P037.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P037.c" 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-tuition-c-P037-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* sum = 1 + 1+2/1*2 + 1+2+3/1*2*3 + ... + 1+2+3+...+n/1*2*3*...*n */ +/* Author - Amit Dutta, Date - 18th OCT, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + double sum = 0, temp1 = 0, temp2 = 1; + int n, i; + printf(&quot;Enter value for n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + temp1 += i; + temp2 *= i; + sum += temp1 / temp2; + } + printf(&quot;\nSum = %g&quot;, sum); + return 0; +}</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('P038.c', 'P038.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P038.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P038-c', 'P038.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P038.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P038.c</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/tuition-c/P038.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P038.c" 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-tuition-c-P038-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check prime number */ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdbool.h&gt; + +int main() +{ + int num, i, endCheckDigit; + bool isPrime = true; + printf(&quot;Enter the number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nOnly a number is allowed, not a character.&quot;); + return 1; + } + if (num &lt;= 0) + { + printf(&quot;\nOnly postive number is allowed.&quot;); + return 1; + } + if (num == 1) + { + printf(&quot;\nInput 1 is not a prime number.&quot; + &quot;\nHas only one positive divisor (itself), not exactly two.&quot; + &quot;\nRule: Prime number should have exactly two distinct positive divisors: 1 and itself&quot;); + return 0; + } + if (num == 2) + { + printf(&quot;\nInput 2 is a prime number.&quot; + &quot;\n(Note: 2 is only Even Prime Number)&quot;); + return 0; + } + if (num % 2 == 0) + { + printf(&quot;\nInput %d is not a prime number.&quot;, num); + return 0; + } + endCheckDigit = sqrt(num); + for (i = 3; i &lt;= endCheckDigit; i += 2) + { + if (num % i == 0) + { + isPrime = false; + printf(&quot;\nInput %d is not prime number.&quot;, num); + return 0; + } + } + if (isPrime) + { + printf(&quot;\nInput %d is a prime number.&quot;, num); + } + return 0; +}</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('P039.c', 'P039.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P039.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P039-c', 'P039.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P039.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P039.c</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/tuition-c/P039.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P039.c" 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-tuition-c-P039-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to print all the factors of a postive integer */ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int num, i; + printf(&quot;Enter a number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + printf(&quot;\nFactors of %d : &quot;, num); + for (i = 1; i &lt;= num / 2; i++) + { + if (num % i == 0) + { + printf(&quot; %d&quot;, i); + } + } + return 0; +}</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('P040.c', 'P040.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P040.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P040-c', 'P040.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P040.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P040.c</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/tuition-c/P040.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P040.c" 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-tuition-c-P040-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to calculate HCF of two positive number */ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int a, b, temp; + printf(&quot;Enter two number : &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + while (b &gt; 0) + { + temp = a; + a = b; + b = temp % b; + } + printf(&quot;HCF = %d&quot;, a); + return 0; +}</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('P041.c', 'P041.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P041.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P041-c', 'P041.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P041.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P041.c</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/tuition-c/P041.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P041.c" 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-tuition-c-P041-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to enter two numbers and check they are co-prime or not. + co-prime when HCF = 1 +*/ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int a, b, temp, temp_a, temp_b; + printf(&quot;Enter two number : &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + temp_a = a; + temp_b = b; + while (b &gt; 0) + { + temp = a; + a = b; + b = temp % b; + } + if (a == 1) + { + printf(&quot;\n(%d, %d) is co-prime.&quot;, temp_a, temp_b); + } + else + { + printf(&quot;\n(%d, %d) is not co-prime.&quot;, temp_a, temp_b); + } + return 0; +}</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('P042.c', 'P042.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P042.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P042-c', 'P042.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P042.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P042.c</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/tuition-c/P042.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P042.c" 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-tuition-c-P042-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to accept a number and check whether the number +is twisted prime or not. */ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int n, t, i, r, rev, prime = 1; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 2; i &lt;= (int)sqrt(n); i++) + { + if (n % i == 0) + { + prime = 0; + break; + } + } + if (prime) + { + printf(&quot;%d is a prime number.&quot;, n); + t = n; + rev = 0; + prime = 1; + while (t &gt; 0) + { + r = t % 10; + rev = rev * 10 + r; + t = t / 10; + } + for (i = 2; i &lt;= (int)sqrt(rev); i++) + { + if (rev % i == 0) + { + prime = 0; + break; + } + } + if (prime) + { + printf(&quot;\n%d and %d are prime numbers.. TWISTED PRIME&quot;, n, rev); + } + else + { + printf(&quot;\n%d is non prime&quot;, rev); + } + } + else + { + printf(&quot;\n%d is non prime.&quot;, n); + } + return 0; +}</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('P043.c', 'P043.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P043.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P043-c', 'P043.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P043.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P043.c</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/tuition-c/P043.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P043.c" 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-tuition-c-P043-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to check palindrome number. */ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +#include &lt;stdio.h&gt; +int main() +{ + int num, temp, rev; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + temp = num; + rev = 0; + while (temp &gt; 0) + { + rev = (rev * 10) + (temp % 10); + temp /= 10; + } + if (num == rev) + { + printf(&quot;%d is a palindrome number.&quot;, num); + } + else + { + printf(&quot;%d is not a palindrome number.&quot;, num); + } + return 0; +}</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('P044.c', 'P044.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P044.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P044-c', 'P044.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P044.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P044.c</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/tuition-c/P044.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P044.c" 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-tuition-c-P044-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input a number and check whether the +number is Pronic number or not. + Pronic Number: The number which is the product of two numbers + which is the product of two consecutive integer. + Ex: 20 = 4 * 5 +*/ +/* Author - Amit Dutta, Date - 27th OCT, 2025 */ + +// using boolean... +/* +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdbool.h&gt; + +int main() +{ + int num, iterationIndex; + bool isPronic = false; + printf(&quot;Enter the number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nYou have to enter a number, not an character or symbol.&quot;); + return 1; + } + if (num &lt; 1) + { + printf(&quot;\nOnly postive number is allowed.&quot;); + return 1; + } + for (iterationIndex = 1; iterationIndex &lt;= num / 2; iterationIndex++) + { + if (iterationIndex * (iterationIndex + 1) == num) + { + printf(&quot;\nInput %d is a Pronic Number.&quot;, num); + isPronic = true; + break; + } + } + if(!isPronic) + { + printf(&quot;\nInput %d is not a Pronic Number.&quot;, num); + } + return 0; +} +*/ + +// using direct return method (more efficient and generally preferred)... + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num, iterationIndex, iterationLimit; + printf(&quot;Enter the number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nYou have to enter a number, not an character or symbol.&quot;); + return 1; + } + if (num &lt; 1) + { + printf(&quot;\nOnly postive number is allowed.&quot;); + return 1; + } + iterationLimit = (int)sqrt(num); + for (iterationIndex = 1; iterationIndex &lt;= iterationLimit; iterationIndex++) + { + if (iterationIndex * (iterationIndex + 1) == num) + { + printf(&quot;\nInput %d is a Pronic Number.&quot;, num); + return 0; + } + } + printf(&quot;\nInput %d is not a Pronic Number.&quot;, num); + return 0; +}</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('P045.c', 'P045.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P045.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P045-c', 'P045.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P045.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P045.c</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/tuition-c/P045.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P045.c" 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-tuition-c-P045-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Make this pattern for input n. + Pattern : + 1 + 1 2 + 1 2 3 + 1 2 3 4 + 1 2 3 4 5 +*/ +/* Author - Amit Dutta, Date - 01st NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, n; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + for (j = 1; j &lt;= i; j++) + { + printf(&quot;%d\t&quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +}</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('P046.c', 'P046.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P046.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P046-c', 'P046.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P046.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P046.c</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/tuition-c/P046.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P046.c" 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-tuition-c-P046-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Make this pattern for input n. + Pattern : + 1 + 2 1 + 3 2 1 + 4 3 2 1 + 5 4 3 2 1 +*/ +/* Author - Amit Dutta, Date - 01st NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, n; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + for (j = i; j &gt;= 1; j--) + { + printf(&quot;%d\t&quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +}</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('P047.c', 'P047.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P047.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P047-c', 'P047.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P047.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P047.c</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/tuition-c/P047.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P047.c" 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-tuition-c-P047-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Make this pattern for input n. + Pattern : + 5 + 5 4 + 5 4 3 + 5 4 3 2 + 5 4 3 2 1 +*/ +/* Author - Amit Dutta, Date - 01st NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, n; + printf(&quot;Enter n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = n; i &gt;= 1; i--) + { + for (j = n; j &gt;= i; j--) + { + printf(&quot;%d\t&quot;, j); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('P048.c', 'P048.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P048.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P048-c', 'P048.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P048.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P048.c</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/tuition-c/P048.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P048.c" 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-tuition-c-P048-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Make this pattern for input n no of row. + Pattern : + 1 + 2 3 + 4 5 6 + 7 8 9 10 + 11 12 13 14 15 +*/ +/* Author - Amit Dutta, Date - 01st NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, n, temp = 1; + printf(&quot;Enter row number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + for (j = 1; j &lt;= i; j++) + { + printf(&quot;%d\t&quot;, temp); + temp++; + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('P049.c', 'P049.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P049.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P049-c', 'P049.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P049.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P049.c</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/tuition-c/P049.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P049.c" 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-tuition-c-P049-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Make this pattern for input n no of row. + Pattern : + # + @ @ + # # # + @ @ @ @ + # # # # # + */ +/* Author - Amit Dutta, Date - 01st NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, n; + char a = &#x27;#&#x27;, b = &#x27;@&#x27;; + printf(&quot;Enter row number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + for (j = 1; j &lt;= i; j++) + { + if (i % 2 == 0) + printf(&quot;%c\t&quot;, b); + else + printf(&quot;%c\t&quot;, a); + } + printf(&quot;\n&quot;); + } + return 0; +} +</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('P050-SHORT.c', 'P050-SHORT.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P050-SHORT.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P050-SHORT-c', 'P050-SHORT.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P050-SHORT.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P050-SHORT.c</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/tuition-c/P050-SHORT.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P050-SHORT.c" 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-tuition-c-P050-SHORT-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input a number and check whether it is Disarium Number or not. + Note : A number is said to Disarium if sum of its digit powered by with their + respective position is equal to the original number. */ +/* Author - Amit Dutta, Date - 08th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + int position = printf(&quot;%d&quot;, num); + int temp = num; + int res = 0; + while (temp &gt; 0) + { + res += (int)pow(temp % 10, position); + position--; + temp /= 10; + } + if (res == num) + printf(&quot; is a Disarium Number.&quot;); + else + printf(&quot; is Not a Disarium Number.&quot;); + return 0; +}</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('P050.c', 'P050.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P050.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P050-c', 'P050.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P050.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P050.c</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/tuition-c/P050.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P050.c" 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-tuition-c-P050-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input a number and check whether it is Disarium Number or not. + Note : A number is said to Disarium if sum of its digit powered by with their + respective position is equal to the original number. */ +/* Author - Amit Dutta, Date - 08th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num, res = 0, temp, position = 0; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;num); + temp = num; + while (temp &gt; 0) + { + position++; + temp /= 10; + } + temp = num; + while (temp &gt; 0) + { + res += (int)pow(temp % 10, position); + position--; + temp /= 10; + } + if (res == num) + printf(&quot;\nInput %d is a Disarium Number.&quot;, num); + else + printf(&quot;\nInput %d is Not a Disarium Number.&quot;, num); + return 0; +}</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('P051.c', 'P051.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P051.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P051-c', 'P051.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P051.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P051.c</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/tuition-c/P051.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P051.c" 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-tuition-c-P051-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to input two number and check whether they are Amicable Pair or not + Example : Sum of Proper Divisors of 220 (1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110) = 284 + Sum of Proper Divisors of 284 (1, 2, 4, 71, 142) = 220 */ +/* Author - Amit Dutta, Date - 09th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int a, b, i, sa = 0, sb = 0; + printf(&quot;Enter two number : &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + for (i = 1; i &lt;= a / 2; i++) + if (a % i == 0) + sa += i; + for (i = 1; i &lt;= b / 2; i++) + if (b % i == 0) + sb += i; + if (sa == b &amp;&amp; sb == a) + printf(&quot;\nInput %d and %d is Amicable Pair.&quot;, a, b); + else + printf(&quot;\nInput %d and %d is Not Amicable Pair.&quot;, a, b); + return 0; +}</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('P052.c', 'P052.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P052.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P052-c', 'P052.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P052.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P052.c</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/tuition-c/P052.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P052.c" 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-tuition-c-P052-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Print the sum of this series for upto n element. + Series: 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3 + 4) + ... + (1 + 2 + 3 + ... + n) */ +/* Author - Amit Dutta, Date - 09th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int n, sum = 0, temp = 0, i; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + for (i = 1; i &lt;= n; i++) + { + temp += i; + sum += temp; + } + printf(&quot;%d&quot;, sum); + return 0; +}</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('P053.c', 'P053.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P053.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P053-c', 'P053.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P053.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P053.c</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/tuition-c/P053.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P053.c" 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-tuition-c-P053-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Print all pattern */ +/* Author - Amit Dutta, Date - 09th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int main() +{ + int i, j, temp; + + printf(&quot;\n\nPattern 1 : \n\n&quot;); + /* + 9 9 9 9 9 + 7 7 7 7 7 + 5 5 5 5 5 + 3 3 3 3 3 + 1 1 1 1 1 + */ + temp = 9; + for (i = 1; i &lt;= 5; i++) + { + for (j = 1; j &lt;= 5; j++) + { + printf(&quot;%d &quot;, temp); + } + printf(&quot;\n&quot;); + temp -= 2; + } + + // Another method print above pattern + printf(&quot;\n\nPattern 1 : \n\n&quot;); + for (i = 9; i &gt;= 1; i -= 2) + { + for (j = 1; j &lt;= 5; j++) + { + printf(&quot;%d &quot;, i); + } + printf(&quot;\n&quot;); + } + + printf(&quot;\n\nPattern 2 : \n\n&quot;); + /* + 1 2 3 4 5 + 1 2 3 4 5 + 1 2 3 4 5 + */ + for (i = 1; i &lt;= 3; i++) + { + for (j = 1; j &lt;= 5; j++) + { + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + + printf(&quot;\n\nPattern 3 : \n\n&quot;); + /* + 5 4 3 2 1 + 5 4 3 2 1 + */ + for (i = 1; i &lt;= 2; i++) + { + for (j = 5; j &gt;= 1; j--) + { + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + + printf(&quot;\n\nPattern 4 : \n\n&quot;); + /* + 1 2 3 4 + 5 6 7 8 + 9 10 11 12 + */ + temp = 1; + for (i = 1; i &lt;= 3; i++) + { + for (j = 1; j &lt;= 4; j++) + { + printf(&quot;%d &quot;, temp); + temp++; + } + printf(&quot;\n&quot;); + } + + printf(&quot;\n\nPattern 5 : \n\n&quot;); + /* + 1 2 3 4 + 4 8 12 16 + 1 2 3 4 + 4 8 12 16 + 1 2 3 4 + */ + for (i = 1; i &lt;= 5; i++) + { + for (j = 1; j &lt;= 4; j++) + { + if (i % 2 == 0) + printf(&quot;%d &quot;, j * 4); + else + printf(&quot;%d &quot;, j); + } + printf(&quot;\n&quot;); + } + + printf(&quot;\n\nPattern 6 : \n\n&quot;); + /* + 1 + 2 4 + 3 5 7 + 6 8 10 12 + 9 11 13 15 17 + */ + int odd = 1, even = 2; + for (i = 1; i &lt;= 5; i++) + { + for (j = 1; j &lt;= i; j++) + { + if (i % 2 == 0) + { + printf(&quot;%d &quot;, even); + even += 2; + } + else + { + printf(&quot;%d &quot;, odd); + odd += 2; + } + } + printf(&quot;\n&quot;); + } + + printf(&quot;\n\nPattern 7 : \n\n&quot;); + /* + 1 2 3 4 5 + 6 7 8 9 + 10 11 12 + 13 14 + 15 + */ + temp = 1; + for (i = 5; i &gt;= 1; i--) + { + for (j = 1; j &lt;= i; j++) + { + printf(&quot;%d &quot;, temp); + temp++; + } + printf(&quot;\n&quot;); + } + + return 0; +}</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('P054.c', 'P054.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P054.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P054-c', 'P054.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P054.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P054.c</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/tuition-c/P054.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P054.c" 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-tuition-c-P054-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to check Krishnamurty number using user defined methods/functions. */ +/* Author - Amit Dutta, Date - 15th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int fact(int); +int isKrishnamurty(int); + +int fact(int n) +{ + int fact = 1, i; + for (i = 1; i &lt;= n; i++) + fact *= i; + return fact; +} + +int isKrishnamurty(int n) +{ + int temp = n, sum = 0; + while (temp &gt; 0) + { + sum += fact(temp % 10); + temp /= 10; + } + return n == sum; +} + +int main() +{ + int n; + printf(&quot;Enter the number : &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (isKrishnamurty(n)) + printf(&quot;\nInput %d is a Krishnamurty Number.&quot;, n); + else + printf(&quot;\nInput %d is not a Krishnamurty number.&quot;, n); + return 0; +}</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('P055.c', 'P055.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P055.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P055-c', 'P055.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P055.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P055.c</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/tuition-c/P055.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P055.c" 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-tuition-c-P055-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to print n terms of Fibbonacci Series (Starting from term 0) */ +/* Author - Amit Dutta, Date - 15th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +void printFibonacci(int); + +void printFibonacci(int n) +{ + int val1 = 0, val2 = 1, val3, i; + printf(&quot;\nFibonacci series upto %d terms :&quot;, n); + if (n &lt; 0) + printf(&quot; N/A&quot;); + if (n == 0) + printf(&quot; %d&quot;, val1); + if (n &gt; 0) + printf(&quot; %d %d&quot;, val1, val2); + for (i = 2; i &lt;= n; i++) + { + val3 = val1 + val2; + printf(&quot; %d&quot;, val3); + val1 = val2; + val2 = val3; + } +} + +int main() +{ + int n; + printf(&quot;Enter the n : &quot;); + scanf(&quot;%d&quot;, &amp;n); + printFibonacci(n); + return 0; +}</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('P056.c', 'P056.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P056.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P056-c', 'P056.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P056.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P056.c</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/tuition-c/P056.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P056.c" 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-tuition-c-P056-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to swap the value of a and b using user defined method. */ +/* Author - Amit Dutta, Date - 22th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +void swap(int *a, int *b) +{ + int temp = *a; + *a = *b; + *b = temp; +} + +int main() +{ + int a, b; + printf(&quot;Enter A and B: &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + printf(&quot;\nBefore swap A: %d, B: %d&quot;, a, b); + swap(&amp;a, &amp;b); + printf(&quot;\nAfter swap A: %d, B: %d&quot;, a, b); + return 0; +}</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('P057.c', 'P057.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P057.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P057-c', 'P057.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P057.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P057.c</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/tuition-c/P057.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P057.c" 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-tuition-c-P057-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to display the series using user defined method. + 0, 7, 26, 63, ... upto n terms using void series(int n) +*/ +/* Author - Amit Dutta, Date - 22th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +void series(int n) +{ + int i; + printf(&quot;\nSeries: &quot;); + for (i = 1; i &lt;= n; i++) + printf(&quot;%d &quot;, (i * i * i) - 1); +} + +int main() +{ + int n; + printf(&quot;Enter n: &quot;); + scanf(&quot;%d&quot;, &amp;n); + series(n); + return 0; +}</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('P058.c', 'P058.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P058.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P058-c', 'P058.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P058.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P058.c</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/tuition-c/P058.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P058.c" 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-tuition-c-P058-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* WAP to display ASCII code of Alphabets (A - Z) using void displayASCII() */ +/* Author - Amit Dutta, Date - 22th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +void displayASCII() +{ + int i; + printf(&quot;ASCII Code\t\tCharacter&quot;); + for (i = &#x27;A&#x27;; i &lt;= &#x27;Z&#x27;; i++) + printf(&quot;\n%c\t\t%d&quot;, i, i); +} + +int main() +{ + displayASCII(); + return 0; +}</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('P059.c', 'P059.c', 'https:/raw.githubusercontent.com/notamitgamer/bsc/main/tuition-c/P059.c')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-tuition-c-P059-c', 'P059.c', 'https://github.com/notamitgamer/bsc/blob/main/tuition-c/P059.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" /> </svg> <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">P059.c</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/tuition-c/P059.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P059.c" 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-tuition-c-P059-c" style="display:none;">/* + * ====================================================================================== + * COPYRIGHT (C) 2025 AMIT DUTTA. ALL RIGHTS RESERVED. + * ====================================================================================== + * Repository: https://github.com/notamitgamer + * Author : Amit Dutta + * License : EDUCATIONAL SOURCE-AVAILABLE LICENSE (ESAL-1.0) + * ====================================================================================== + * + * [ IMPORTANT LEGAL NOTICE ] + * + * 1. PROPRIETARY STATUS: + * This software (&quot;The Software&quot;) is the intellectual property of Amit Dutta. + * It is NOT &quot;Open Source&quot; in the traditional sense. It is &quot;Source-Available&quot; + * for educational observation only. + * + * 2. ACADEMIC INTEGRITY &amp; RESTRICTION: + * The use of this code, in whole or in part, for the purpose of submitting + * academic assignments, projects, lab reports, or examinations at + * WEST BENGAL STATE UNIVERSITY (WBSU) or any other educational institution + * is STRICTLY PROHIBITED. + * + * &gt;&gt;&gt; VIOLATION OF THIS CLAUSE WILL BE REPORTED AS ACADEMIC MISCONDUCT. &lt;&lt;&lt; + * + * 3. PERMISSIONS: + * You are granted a revocable license to: + * - Read and study the code to understand algorithms. + * - Compile and run the code locally for personal testing. + * + * 4. NO WARRANTY: + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND. + * + * ====================================================================================== + */ + +/* Write a program to find the sum of array elements using following fuctions + int array_sum(int a[], int n); + void get_data(int a[], int n); + voidd dispaly(int a[], int n); +*/ +/* Author - Amit Dutta, Date - 29th November, 2025 */ + +// This code has not been compiled. +// If you find any issues, please create a new issue on GitHub regarding them. +// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues + +#include &lt;stdio.h&gt; + +int array_sum(int[], int); +void get_data(int[], int); +void display(int[], int); + +int main() +{ + int size, arr[20]; + printf(&quot;How many element do you want to add (Max: 20): &quot;); + scanf(&quot;%d&quot;, &amp;size); + if (size &lt; 1 &amp;&amp; size &gt; 20) + { + printf(&quot;\nMax Element count is 20.&quot;); + return 1; + } + get_data(arr, size); + display(arr, size); + printf(&quot;\nSum of the elements is: %d&quot;, array_sum(arr, size)); + return 0; +} + +void get_data(int a[], int n) +{ + int i; + for (i = 0; i &lt; n; i++) + { + printf(&quot;Enter element for position %d: &quot;, i); + scanf(&quot;%d&quot;, &amp;a[i]); + } +} + +void display(int a[], int n) +{ + int i; + printf(&quot;\nArray: [&quot;); + for (i = 0; i &lt; n; i++) + { + printf(&quot;%d&quot;, a[i]); + if (i != n - 1) + printf(&quot;, &quot;); + } + printf(&quot;]\n&quot;); +} + +int array_sum(int a[], int n) +{ + int i, sum = 0; + for (i = 0; i &lt; n; i++) + sum += a[i]; + return sum; +}</div> </div> </div> @@ -3565,7 +20087,7 @@ </div> </div> <div class="flex items-center gap-1 sm:gap-2 shrink-0"> - <!-- Share/Copy Button --> + <!-- Share Button --> <button id="share-btn" class="p-2 text-slate-400 hover:text-white hover:bg-slate-700/50 rounded-lg transition-all group relative" @@ -3602,6 +20124,46 @@ /> </svg> </button> + + <!-- Copy Code Button --> + <button + id="copy-code-btn" + class="p-2 text-slate-400 hover:text-white hover:bg-slate-700/50 rounded-lg transition-all group relative" + title="Copy Code" + > + <svg + id="copy-icon-default" + xmlns="http://www.w3.org/2000/svg" + class="h-5 w-5" + fill="none" + viewBox="0 0 24 24" + stroke="currentColor" + > + <path + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" + /> + </svg> + <svg + id="copy-icon-success" + xmlns="http://www.w3.org/2000/svg" + class="h-5 w-5 text-green-400 hidden transform scale-0 transition-transform duration-200" + fill="none" + viewBox="0 0 24 24" + stroke="currentColor" + > + <path + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + d="M5 13l4 4L19 7" + /> + </svg> + </button> + + <!-- View on GitHub Button --> <a id="modal-raw-link" href="#" @@ -3616,10 +20178,9 @@ viewBox="0 0 24 24" > <path - stroke-linecap="round" - stroke-linejoin="round" - stroke-width="2" - d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" + 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> @@ -3649,7 +20210,7 @@ <!-- Loading State --> <div id="code-loading" - class="absolute inset-0 flex items-center justify-center z-10 bg-[#0d1117]" + class="absolute inset-0 flex items-center justify-center z-10 bg-[#0d1117] hidden" > <div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" @@ -3774,70 +20335,33 @@ <script> function toggleFolder(header) { - // We handle two cases: - // 1. onclick="toggleFolder(event)" (Modern, if you update python script) - // 2. onclick="toggleFolder('folder-name')" (Legacy/Current python script behavior) - - let headerEl = null; - + // Handle both Event objects (from onclick="toggleFolder(event)") + // and Element objects (from onclick="toggleFolder(this)") if (header instanceof Event) { - headerEl = header.currentTarget; - } else if (header instanceof Element) { - headerEl = header; - } else if (typeof header === 'string') { - // Legacy Case: header is an ID string like "assignment-primary" - // The button element usually has an ID or we can find it relative to the structure - // Assuming the python script generates: <button ... onclick="toggleFolder('id')"> - // In that case, 'this' context in inline onclick refers to window, but we need the element. - // However, inline onclick="toggleFolder('id')" doesn't pass 'this'. - - // Fix strategy: Look for the element with the ID passed, OR look for the event target if available. - // Since we can't easily get 'this' if it wasn't passed, we'll try to find the button that has this onclick. - // A more robust way in legacy code without changing Python is to look for the element by ID if the folder container has that ID. - - // Let's try to find the element by ID if possible (assuming folder header might have ID) - // If that fails, we use the global event object (deprecated but works in most browsers for inline handlers) - - if (window.event && window.event.currentTarget) { - headerEl = window.event.currentTarget; - } else { - console.warn("toggleFolder: Could not determine clicked element from string argument. Trying ID lookup."); - // Fallback: If your python script assigns IDs to the header divs matching the folder name - headerEl = document.getElementById(header); - } + header = header.currentTarget; } // Sanity Check - if (!headerEl || typeof headerEl.querySelector !== 'function') { - console.error("toggleFolder Error: Could not resolve header element.", header); + if (!header || typeof header.querySelector !== 'function') { + console.error("toggleFolder Error: Invalid header argument.", header); return; } - const content = headerEl.nextElementSibling; - const icon = headerEl.querySelector(".chevron"); - const folderIcon = headerEl.querySelector(".folder-icon"); - - if (!content) { - console.error("toggleFolder Error: Content sibling not found."); - return; - } + const content = header.nextElementSibling; + const icon = header.querySelector(".chevron"); + const folderIcon = header.querySelector(".folder-icon"); // Toggle hidden class content.classList.toggle("hidden"); - - if (icon) { - icon.classList.toggle("rotated"); - } + icon.classList.toggle("rotated"); - if (folderIcon) { - // Optional: Change folder icon (open/closed) - if (content.classList.contains("hidden")) { - // Closed folder - folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>`; - } else { - // Open folder (visual enhancement) - folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z"></path>`; - } + // Optional: Change folder icon (open/closed) + if (content.classList.contains("hidden")) { + // Closed folder + folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>`; + } else { + // Open folder (visual enhancement) + folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z"></path>`; } } @@ -3848,13 +20372,12 @@ const modalRawLink = document.getElementById("modal-raw-link"); const loadingSpinner = document.getElementById("code-loading"); - // We'll store the current file URL for sharing let currentFileUrl = ""; - function showCode(fileUrl, filename, rawUrl) { - currentFileUrl = window.location.href.split("?")[0] + "?file=" + encodeURIComponent(filename); // Construct shareable URL + // MODIFIED: Fetch from hidden ID instead of Network URL + function showCode(storageId, filename, rawUrl) { + currentFileUrl = window.location.href.split("?")[0] + "?file=" + encodeURIComponent(filename); modal.classList.remove("hidden"); - // Trigger reflow for animation void modal.offsetWidth; modal.classList.remove("opacity-0"); modal.querySelector("div").classList.remove("scale-95"); @@ -3867,30 +20390,25 @@ const shareIconSuccess = document.getElementById("share-icon-success"); shareIconDefault.classList.remove("hidden", "scale-0"); shareIconSuccess.classList.add("hidden", "scale-0"); + + // Reset Copy Button State + const copyIconDefault = document.getElementById("copy-icon-default"); + const copyIconSuccess = document.getElementById("copy-icon-success"); + copyIconDefault.classList.remove("hidden", "scale-0"); + copyIconSuccess.classList.add("hidden", "scale-0"); - // Show loading - loadingSpinner.classList.remove("hidden"); - modalCodeBlock.textContent = ""; // Clear previous content - - // Fetch the code content - fetch(rawUrl) - .then((response) => { - if (!response.ok) throw new Error("Network response was not ok"); - return response.text(); - }) - .then((text) => { - modalCodeBlock.textContent = text; - // Apply syntax highlighting - delete modalCodeBlock.dataset.highlighted; // Clear highlighted state - hljs.highlightElement(modalCodeBlock); - loadingSpinner.classList.add("hidden"); - }) - .catch((err) => { - modalCodeBlock.textContent = "Error loading code: " + err.message; - loadingSpinner.classList.add("hidden"); - }); + // LOAD FROM HIDDEN ELEMENT + const storedContent = document.getElementById(storageId); + + if (storedContent) { + modalCodeBlock.innerHTML = storedContent.innerHTML; + delete modalCodeBlock.dataset.highlighted; + hljs.highlightElement(modalCodeBlock); + } else { + modalCodeBlock.textContent = "Error: Code content not found in page."; + } - // Update URL history without reloading + // Update URL history const newUrl = new URL(window.location); newUrl.searchParams.set('file', filename); window.history.pushState({ path: newUrl.href }, '', newUrl.href); @@ -3900,13 +20418,11 @@ modal.classList.add("opacity-0"); modal.querySelector("div").classList.add("scale-95"); - // Wait for animation to finish before hiding display setTimeout(() => { modal.classList.add("hidden"); modalCodeBlock.textContent = ""; }, 200); - // Clear URL param const newUrl = new URL(window.location); newUrl.searchParams.delete('file'); window.history.pushState({ path: newUrl.href }, '', newUrl.href); @@ -3917,7 +20433,6 @@ function showLicense() { licenseModal.classList.remove("hidden"); - // Trigger reflow for animation void licenseModal.offsetWidth; licenseModal.classList.remove("opacity-0"); licenseModal.querySelector("div").classList.remove("scale-95"); @@ -3931,7 +20446,6 @@ }, 200); } - // Close license modal on escape or click outside document.addEventListener("keydown", (e) => { if (e.key === "Escape" && !licenseModal.classList.contains("hidden")) { hideLicense(); @@ -3945,19 +20459,14 @@ }); /* --- Search Logic --- */ - // Use a debounced search for better performance if list is huge - let searchIndex = []; // Will store { name: "filename", element: DOMElement, parent: FolderDOMElement } + let searchIndex = []; function buildSearchIndex() { searchIndex = []; const fileElements = document.querySelectorAll(".file-item"); fileElements.forEach((el) => { - const name = el - .querySelector("span") - .textContent.toLowerCase() - .trim(); - // Find parent folder content div to open it if match found - const parentContent = el.closest(".pl-4"); // based on structure + const name = el.querySelector("span").textContent.toLowerCase().trim(); + const parentContent = el.closest(".pl-4"); searchIndex.push({ name, element: el, parent: parentContent }); }); } @@ -3965,61 +20474,40 @@ const searchInput = document.getElementById("search-input"); searchInput.addEventListener("input", (e) => { const query = e.target.value.toLowerCase(); - - // If index empty (lazy load), build it if (searchIndex.length === 0) buildSearchIndex(); - // If query is empty, show everything if (!query) { document.querySelectorAll('.file-item, .folder-container').forEach(el => el.classList.remove('hidden')); - // Re-close folders that were originally closed? - // Simplest: Just collapse all folders or keep current state. - // For now, let's just make sure files are visible. return; } - // Hide all first - // actually, hiding everything and showing matches is cleaner document.querySelectorAll('.file-item').forEach(el => el.classList.add('hidden')); document.querySelectorAll('.folder-container').forEach(el => el.classList.add('hidden')); - let hasResults = false; - searchIndex.forEach(item => { if (item.name.includes(query)) { - // Show file item.element.classList.remove('hidden'); - // Show parent folder container - // This logic is a bit tricky with nested folders. - // We need to walk up the DOM to show all parent folders. let parent = item.element.parentElement; while(parent && parent.id !== "file-list-container") { - parent.classList.remove('hidden'); // Show content div + parent.classList.remove('hidden'); if (parent.previousElementSibling) { - // This is the folder header (button) - // Make sure the folder container wrapping both is visible const folderContainer = parent.parentElement; if(folderContainer.classList.contains('folder-container')) { folderContainer.classList.remove('hidden'); } - // Expand the folder visually if(parent.classList.contains('hidden')) { - // this check is redundant due to line above, but for clarity: - // we removed hidden above. Now rotate chevron. const chevron = parent.previousElementSibling.querySelector('.chevron'); if(chevron && !chevron.classList.contains('rotated')) { chevron.classList.add('rotated'); } - // Update folder icon to open const fIcon = parent.previousElementSibling.querySelector('.folder-icon'); if(fIcon) fIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z"></path>`; } } parent = parent.parentElement; } - hasResults = true; } }); }); @@ -4036,23 +20524,14 @@ } document.addEventListener("DOMContentLoaded", () => { - // Check URL params for shared file const params = new URLSearchParams(window.location.search); const sharedFile = params.get('file'); if (sharedFile) { - // Find the file element to get the raw URL - // We need to wait for the injection. - // Since injection happens on server/build time, DOM is ready. - // We just need to find the link. - // We can search the DOM for a file-item with matching text. const fileElements = document.querySelectorAll(".file-item"); for (let el of fileElements) { const name = el.querySelector("span").textContent.trim(); if (name === sharedFile) { - // Simulate click or manually call showCode const onClickAttr = el.getAttribute('onclick'); - // Extract args from onclick string: showCode('url', 'name', 'raw') - // Regex or simple parsing const match = onClickAttr.match(/showCode\('([^']*)',\s*'([^']*)',\s*'([^']*)'\)/); if (match) { showCode(match[1], match[2], match[3]); @@ -4089,24 +20568,32 @@ }); } }); + + /* --- Copy Code Functionality --- */ + const copyCodeBtn = document.getElementById("copy-code-btn"); + const copyIconDefault = document.getElementById("copy-icon-default"); + const copyIconSuccess = document.getElementById("copy-icon-success"); + + copyCodeBtn.addEventListener("click", () => { + const codeText = modalCodeBlock.innerText; + navigator.clipboard.writeText(codeText).then(() => { + animateSuccess(copyCodeBtn, copyIconDefault, copyIconSuccess); + }).catch(err => { + console.error('Failed to copy code: ', err); + }); + }); document.addEventListener("keydown", (e) => { const searchInput = document.getElementById("search-input"); - - // 1. ESCAPE key closes modal if (e.key === "Escape" && !modal.classList.contains("hidden")) { hideCode(); return; } - - // 2. '/' key focuses search bar - // Check if the key is '/', the modal is not open, and the current focus is not an input field if ( e.key === "/" && modal.classList.contains("hidden") && !/^(INPUT|TEXTAREA|SELECT)$/i.test(document.activeElement.tagName) ) { - // Prevent the '/' character from being typed outside the input field e.preventDefault(); searchInput.focus(); } diff --git a/docs/template.html b/docs/template.html @@ -3,6 +3,8 @@ <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <!-- Fix favicon 404 error --> + <link rel="icon" href="data:,"> <title>notamitgamer/bsc Repository File Index</title> <script src="https://cdn.tailwindcss.com"></script> <link @@ -125,7 +127,7 @@ </p> </div> </div> - <!-- Mobile: Github Icon (Visible only on small screens to save space in row 2) --> + <!-- Mobile: Github Icon --> <a href="https://github.com/notamitgamer/bsc" target="_blank" class="sm:hidden text-slate-600 hover:text-slate-900"> <svg class="w-6 h-6" 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> @@ -172,16 +174,8 @@ class="hidden sm:flex bg-slate-900 hover:bg-slate-800 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all shadow-sm items-center gap-2" > <span>GitHub</span> - <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 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> @@ -226,7 +220,7 @@ </div> </div> <div class="flex items-center gap-1 sm:gap-2 shrink-0"> - <!-- Share/Copy Button --> + <!-- Share Button --> <button id="share-btn" class="p-2 text-slate-400 hover:text-white hover:bg-slate-700/50 rounded-lg transition-all group relative" @@ -263,6 +257,46 @@ /> </svg> </button> + + <!-- Copy Code Button --> + <button + id="copy-code-btn" + class="p-2 text-slate-400 hover:text-white hover:bg-slate-700/50 rounded-lg transition-all group relative" + title="Copy Code" + > + <svg + id="copy-icon-default" + xmlns="http://www.w3.org/2000/svg" + class="h-5 w-5" + fill="none" + viewBox="0 0 24 24" + stroke="currentColor" + > + <path + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" + /> + </svg> + <svg + id="copy-icon-success" + xmlns="http://www.w3.org/2000/svg" + class="h-5 w-5 text-green-400 hidden transform scale-0 transition-transform duration-200" + fill="none" + viewBox="0 0 24 24" + stroke="currentColor" + > + <path + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + d="M5 13l4 4L19 7" + /> + </svg> + </button> + + <!-- View on GitHub Button --> <a id="modal-raw-link" href="#" @@ -277,10 +311,9 @@ viewBox="0 0 24 24" > <path - stroke-linecap="round" - stroke-linejoin="round" - stroke-width="2" - d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" + 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> @@ -310,7 +343,7 @@ <!-- Loading State --> <div id="code-loading" - class="absolute inset-0 flex items-center justify-center z-10 bg-[#0d1117]" + class="absolute inset-0 flex items-center justify-center z-10 bg-[#0d1117] hidden" > <div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" @@ -435,70 +468,33 @@ <script> function toggleFolder(header) { - // We handle two cases: - // 1. onclick="toggleFolder(event)" (Modern, if you update python script) - // 2. onclick="toggleFolder('folder-name')" (Legacy/Current python script behavior) - - let headerEl = null; - + // Handle both Event objects (from onclick="toggleFolder(event)") + // and Element objects (from onclick="toggleFolder(this)") if (header instanceof Event) { - headerEl = header.currentTarget; - } else if (header instanceof Element) { - headerEl = header; - } else if (typeof header === 'string') { - // Legacy Case: header is an ID string like "assignment-primary" - // The button element usually has an ID or we can find it relative to the structure - // Assuming the python script generates: <button ... onclick="toggleFolder('id')"> - // In that case, 'this' context in inline onclick refers to window, but we need the element. - // However, inline onclick="toggleFolder('id')" doesn't pass 'this'. - - // Fix strategy: Look for the element with the ID passed, OR look for the event target if available. - // Since we can't easily get 'this' if it wasn't passed, we'll try to find the button that has this onclick. - // A more robust way in legacy code without changing Python is to look for the element by ID if the folder container has that ID. - - // Let's try to find the element by ID if possible (assuming folder header might have ID) - // If that fails, we use the global event object (deprecated but works in most browsers for inline handlers) - - if (window.event && window.event.currentTarget) { - headerEl = window.event.currentTarget; - } else { - console.warn("toggleFolder: Could not determine clicked element from string argument. Trying ID lookup."); - // Fallback: If your python script assigns IDs to the header divs matching the folder name - headerEl = document.getElementById(header); - } + header = header.currentTarget; } // Sanity Check - if (!headerEl || typeof headerEl.querySelector !== 'function') { - console.error("toggleFolder Error: Could not resolve header element.", header); + if (!header || typeof header.querySelector !== 'function') { + console.error("toggleFolder Error: Invalid header argument.", header); return; } - const content = headerEl.nextElementSibling; - const icon = headerEl.querySelector(".chevron"); - const folderIcon = headerEl.querySelector(".folder-icon"); - - if (!content) { - console.error("toggleFolder Error: Content sibling not found."); - return; - } + const content = header.nextElementSibling; + const icon = header.querySelector(".chevron"); + const folderIcon = header.querySelector(".folder-icon"); // Toggle hidden class content.classList.toggle("hidden"); - - if (icon) { - icon.classList.toggle("rotated"); - } - - if (folderIcon) { - // Optional: Change folder icon (open/closed) - if (content.classList.contains("hidden")) { - // Closed folder - folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>`; - } else { - // Open folder (visual enhancement) - folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z"></path>`; - } + icon.classList.toggle("rotated"); + + // Optional: Change folder icon (open/closed) + if (content.classList.contains("hidden")) { + // Closed folder + folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>`; + } else { + // Open folder (visual enhancement) + folderIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z"></path>`; } } @@ -509,13 +505,12 @@ const modalRawLink = document.getElementById("modal-raw-link"); const loadingSpinner = document.getElementById("code-loading"); - // We'll store the current file URL for sharing let currentFileUrl = ""; - function showCode(fileUrl, filename, rawUrl) { - currentFileUrl = window.location.href.split("?")[0] + "?file=" + encodeURIComponent(filename); // Construct shareable URL + // MODIFIED: Fetch from hidden ID instead of Network URL + function showCode(storageId, filename, rawUrl) { + currentFileUrl = window.location.href.split("?")[0] + "?file=" + encodeURIComponent(filename); modal.classList.remove("hidden"); - // Trigger reflow for animation void modal.offsetWidth; modal.classList.remove("opacity-0"); modal.querySelector("div").classList.remove("scale-95"); @@ -528,30 +523,25 @@ const shareIconSuccess = document.getElementById("share-icon-success"); shareIconDefault.classList.remove("hidden", "scale-0"); shareIconSuccess.classList.add("hidden", "scale-0"); - - // Show loading - loadingSpinner.classList.remove("hidden"); - modalCodeBlock.textContent = ""; // Clear previous content - - // Fetch the code content - fetch(rawUrl) - .then((response) => { - if (!response.ok) throw new Error("Network response was not ok"); - return response.text(); - }) - .then((text) => { - modalCodeBlock.textContent = text; - // Apply syntax highlighting - delete modalCodeBlock.dataset.highlighted; // Clear highlighted state - hljs.highlightElement(modalCodeBlock); - loadingSpinner.classList.add("hidden"); - }) - .catch((err) => { - modalCodeBlock.textContent = "Error loading code: " + err.message; - loadingSpinner.classList.add("hidden"); - }); + + // Reset Copy Button State + const copyIconDefault = document.getElementById("copy-icon-default"); + const copyIconSuccess = document.getElementById("copy-icon-success"); + copyIconDefault.classList.remove("hidden", "scale-0"); + copyIconSuccess.classList.add("hidden", "scale-0"); + + // LOAD FROM HIDDEN ELEMENT + const storedContent = document.getElementById(storageId); + + if (storedContent) { + modalCodeBlock.innerHTML = storedContent.innerHTML; + delete modalCodeBlock.dataset.highlighted; + hljs.highlightElement(modalCodeBlock); + } else { + modalCodeBlock.textContent = "Error: Code content not found in page."; + } - // Update URL history without reloading + // Update URL history const newUrl = new URL(window.location); newUrl.searchParams.set('file', filename); window.history.pushState({ path: newUrl.href }, '', newUrl.href); @@ -561,13 +551,11 @@ modal.classList.add("opacity-0"); modal.querySelector("div").classList.add("scale-95"); - // Wait for animation to finish before hiding display setTimeout(() => { modal.classList.add("hidden"); modalCodeBlock.textContent = ""; }, 200); - // Clear URL param const newUrl = new URL(window.location); newUrl.searchParams.delete('file'); window.history.pushState({ path: newUrl.href }, '', newUrl.href); @@ -578,7 +566,6 @@ function showLicense() { licenseModal.classList.remove("hidden"); - // Trigger reflow for animation void licenseModal.offsetWidth; licenseModal.classList.remove("opacity-0"); licenseModal.querySelector("div").classList.remove("scale-95"); @@ -592,7 +579,6 @@ }, 200); } - // Close license modal on escape or click outside document.addEventListener("keydown", (e) => { if (e.key === "Escape" && !licenseModal.classList.contains("hidden")) { hideLicense(); @@ -606,19 +592,14 @@ }); /* --- Search Logic --- */ - // Use a debounced search for better performance if list is huge - let searchIndex = []; // Will store { name: "filename", element: DOMElement, parent: FolderDOMElement } + let searchIndex = []; function buildSearchIndex() { searchIndex = []; const fileElements = document.querySelectorAll(".file-item"); fileElements.forEach((el) => { - const name = el - .querySelector("span") - .textContent.toLowerCase() - .trim(); - // Find parent folder content div to open it if match found - const parentContent = el.closest(".pl-4"); // based on structure + const name = el.querySelector("span").textContent.toLowerCase().trim(); + const parentContent = el.closest(".pl-4"); searchIndex.push({ name, element: el, parent: parentContent }); }); } @@ -626,61 +607,40 @@ const searchInput = document.getElementById("search-input"); searchInput.addEventListener("input", (e) => { const query = e.target.value.toLowerCase(); - - // If index empty (lazy load), build it if (searchIndex.length === 0) buildSearchIndex(); - // If query is empty, show everything if (!query) { document.querySelectorAll('.file-item, .folder-container').forEach(el => el.classList.remove('hidden')); - // Re-close folders that were originally closed? - // Simplest: Just collapse all folders or keep current state. - // For now, let's just make sure files are visible. return; } - // Hide all first - // actually, hiding everything and showing matches is cleaner document.querySelectorAll('.file-item').forEach(el => el.classList.add('hidden')); document.querySelectorAll('.folder-container').forEach(el => el.classList.add('hidden')); - let hasResults = false; - searchIndex.forEach(item => { if (item.name.includes(query)) { - // Show file item.element.classList.remove('hidden'); - // Show parent folder container - // This logic is a bit tricky with nested folders. - // We need to walk up the DOM to show all parent folders. let parent = item.element.parentElement; while(parent && parent.id !== "file-list-container") { - parent.classList.remove('hidden'); // Show content div + parent.classList.remove('hidden'); if (parent.previousElementSibling) { - // This is the folder header (button) - // Make sure the folder container wrapping both is visible const folderContainer = parent.parentElement; if(folderContainer.classList.contains('folder-container')) { folderContainer.classList.remove('hidden'); } - // Expand the folder visually if(parent.classList.contains('hidden')) { - // this check is redundant due to line above, but for clarity: - // we removed hidden above. Now rotate chevron. const chevron = parent.previousElementSibling.querySelector('.chevron'); if(chevron && !chevron.classList.contains('rotated')) { chevron.classList.add('rotated'); } - // Update folder icon to open const fIcon = parent.previousElementSibling.querySelector('.folder-icon'); if(fIcon) fIcon.innerHTML = `<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z"></path>`; } } parent = parent.parentElement; } - hasResults = true; } }); }); @@ -697,23 +657,14 @@ } document.addEventListener("DOMContentLoaded", () => { - // Check URL params for shared file const params = new URLSearchParams(window.location.search); const sharedFile = params.get('file'); if (sharedFile) { - // Find the file element to get the raw URL - // We need to wait for the injection. - // Since injection happens on server/build time, DOM is ready. - // We just need to find the link. - // We can search the DOM for a file-item with matching text. const fileElements = document.querySelectorAll(".file-item"); for (let el of fileElements) { const name = el.querySelector("span").textContent.trim(); if (name === sharedFile) { - // Simulate click or manually call showCode const onClickAttr = el.getAttribute('onclick'); - // Extract args from onclick string: showCode('url', 'name', 'raw') - // Regex or simple parsing const match = onClickAttr.match(/showCode\('([^']*)',\s*'([^']*)',\s*'([^']*)'\)/); if (match) { showCode(match[1], match[2], match[3]); @@ -750,24 +701,32 @@ }); } }); + + /* --- Copy Code Functionality --- */ + const copyCodeBtn = document.getElementById("copy-code-btn"); + const copyIconDefault = document.getElementById("copy-icon-default"); + const copyIconSuccess = document.getElementById("copy-icon-success"); + + copyCodeBtn.addEventListener("click", () => { + const codeText = modalCodeBlock.innerText; + navigator.clipboard.writeText(codeText).then(() => { + animateSuccess(copyCodeBtn, copyIconDefault, copyIconSuccess); + }).catch(err => { + console.error('Failed to copy code: ', err); + }); + }); document.addEventListener("keydown", (e) => { const searchInput = document.getElementById("search-input"); - - // 1. ESCAPE key closes modal if (e.key === "Escape" && !modal.classList.contains("hidden")) { hideCode(); return; } - - // 2. '/' key focuses search bar - // Check if the key is '/', the modal is not open, and the current focus is not an input field if ( e.key === "/" && modal.classList.contains("hidden") && !/^(INPUT|TEXTAREA|SELECT)$/i.test(document.activeElement.tagName) ) { - // Prevent the '/' character from being typed outside the input field e.preventDefault(); searchInput.focus(); }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror