commit 3c2bd4af00d5adda20ad923b16d4a24180a53adc
parent 70a704aaf12e629388c8f2bb5f1989287f87cd1f
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Sun, 12 Oct 2025 14:37:58 +0530
docs
Diffstat:
| M | docs/generate_index.py | | | 122 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------- |
| M | docs/index.html | | | 4397 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- |
| M | docs/template.html | | | 336 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- |
3 files changed, 4429 insertions(+), 426 deletions(-)
diff --git a/docs/generate_index.py b/docs/generate_index.py
@@ -1,4 +1,5 @@
import os
+import html
# --- Configuration ---
# The root URL of your repository.
@@ -7,47 +8,48 @@ REPO_URL = "https://github.com/notamitgamer/bsc"
EXCLUDED_DIRS = ['.git', '.github', '.vscode', 'MinGW64', 'print', 'docs']
# List of files to exclude from the list.
EXCLUDED_FILES = ['index.html', 'README.md', 'CODE_OF_CONDUCT.md', 'CONTRIBUTING.md',
- 'LICENSE', 'main.js', 'package.json', 'SECURITY.md', 'server.js', 'template.html']
+ 'LICENSE', 'main.js', 'package.json', 'SECURITY.md', 'server.js', 'template.html', 'generate_index.py']
# --- 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'
+ return 'plaintext'
+
def generate_file_list():
"""Walks the repo and generates an HTML list of its files and directories with folder contents."""
items = []
- # SVG Icons for folders and files
+ # SVG Icons
folder_icon = '<svg class="w-6 h-6 text-blue-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><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></svg>'
file_icon = '<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>'
chevron_down = '<svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>'
+ github_icon = '<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>'
# Walk through the repository's root directory
for root, dirs, files in os.walk('.', topdown=True):
- # Exclude specified directories from being traversed
dirs[:] = [d for d in dirs if d not in EXCLUDED_DIRS]
if root == '.':
- # Sort directories alphabetically
dirs.sort()
files.sort()
- # Create expandable sections for directories with their contents
for dirname in dirs:
encoded_dirname = dirname.replace(' ', '%20')
folder_url = f"{REPO_URL}/tree/main/{encoded_dirname}"
-
- # Get files in this directory
dir_path = os.path.join('.', dirname)
try:
- dir_files = []
- if os.path.exists(dir_path):
- for item in os.listdir(dir_path):
- item_path = os.path.join(dir_path, item)
- if os.path.isfile(item_path) and not item.startswith('.'):
- # Filter out .exe files and other binary files
- if not item.endswith(('.exe', '.png', '.jpg', '.jpeg', '.gif', '.md')):
- dir_files.append(item)
- dir_files.sort()
+ dir_files = sorted([item for item in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, item)) and not item.startswith('.') and not item.endswith(('.exe', '.png', '.jpg', '.jpeg', '.gif', '.md'))])
- # Create folder section with files
file_count = len(dir_files)
folder_header = f'''
<li class="border rounded-lg overflow-hidden">
@@ -58,8 +60,10 @@ def generate_file_list():
<span class="font-medium text-gray-800">{dirname}</span>
<span class="ml-2 text-sm text-gray-500">({file_count} files)</span>
</div>
- <div class="flex items-center space-x-2">
- <a href="{folder_url}" target="_blank" class="text-blue-500 font-semibold text-sm hover:underline" onclick="event.stopPropagation()">GitHub</a>
+ <div class="flex items-center space-x-4">
+ <a href="{folder_url}" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub">
+ {github_icon}
+ </a>
<div class="chevron" id="chevron-{dirname}">{chevron_down}</div>
</div>
</div>
@@ -69,25 +73,43 @@ def generate_file_list():
items.append(folder_header)
- # Add files in the directory
for filename in dir_files:
encoded_filename = filename.replace(' ', '%20')
+ file_path = os.path.join(dirname, filename)
file_url = f"{REPO_URL}/blob/main/{encoded_dirname}/{encoded_filename}"
+
+ file_content = ""
+ try:
+ with open(file_path, 'r', encoding='utf-8', errors='ignore') as f:
+ file_content = f.read()
+ except Exception as e:
+ file_content = f"Error reading file: {e}"
+
+ escaped_content = html.escape(file_content)
+ code_block_id = f"code-{dirname}-{filename}".replace('.', '_').replace(' ', '_')
+ lang_class = get_language_class(filename)
+
file_item = f'''
<li>
- <a href="{file_url}" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
{file_icon}
<span class="text-gray-700">{filename}</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="{file_url}" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ {github_icon}
+ </a>
+ <button onclick="showCode('{code_block_id}', '{filename}')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="{code_block_id}" class="hidden" data-github-url="{file_url}">
+ <pre><code class="language-{lang_class}">{escaped_content}</code></pre>
+ </div>
</li>'''
items.append(file_item)
- # Close folder section
items.append(' </ul>\n </div>\n </li>')
except (OSError, PermissionError):
- # If we can't access the directory, just show it as a simple folder
simple_folder = f'''
<li>
<a href="{folder_url}" target="_blank" class="flex items-center p-4 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200">
@@ -98,35 +120,61 @@ def generate_file_list():
</li>'''
items.append(simple_folder)
- # Add top-level files (if any)
top_level_files = [f for f in files if f not in EXCLUDED_FILES]
for filename in top_level_files:
encoded_filename = filename.replace(' ', '%20')
url = f"{REPO_URL}/blob/main/{encoded_filename}"
- items.append(f'<li><a href="{url}" target="_blank" class="flex items-center p-4 bg-gray-100 hover:bg-green-100 rounded-lg transition-colors duration-200">{file_icon}<span class="font-medium text-gray-800">{filename}</span><span class="ml-auto text-green-500 font-semibold text-sm">View on GitHub →</span></a></li>')
+
+ file_content = ""
+ try:
+ with open(filename, 'r', encoding='utf-8', errors='ignore') as f:
+ file_content = f.read()
+ except Exception as e:
+ file_content = f"Error reading file: {e}"
+
+ escaped_content = html.escape(file_content)
+ code_block_id = f"code-root-{filename}".replace('.', '_').replace(' ', '_')
+ lang_class = get_language_class(filename)
+
+ items.append(f'''
+ <li class="border rounded-lg overflow-hidden">
+ <div class="flex items-center p-4 bg-gray-100 hover:bg-green-100 rounded-lg transition-colors duration-200">
+ {file_icon}
+ <span class="font-medium text-gray-800">{filename}</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="{url}" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ {github_icon}
+ </a>
+ <button onclick="showCode('{code_block_id}', '{filename}')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="{code_block_id}" class="hidden bg-white p-4 border-t" data-github-url="{url}">
+ <pre><code class="language-{lang_class}">{escaped_content}</code></pre>
+ </div>
+ </li>''')
- break # Only process the top level
+ break
return "\n".join(items)
def main():
"""Generates the final index.html from a template."""
- # Get the directory of this script
script_dir = os.path.dirname(os.path.abspath(__file__))
- repo_root = os.path.dirname(script_dir) # Go up one level from docs/
+ # Assuming the script is run from a sub-directory like 'docs'
+ repo_root = os.path.abspath(os.path.join(script_dir, '..'))
- # Change to repo root directory for file walking
original_cwd = os.getcwd()
- os.chdir(repo_root)
+ # It's better to construct paths from the repo_root than to change directory
try:
- # Define paths relative to the script location
+ # Construct paths relative to the repo root
+ os.chdir(repo_root)
template_path = os.path.join(script_dir, 'template.html')
output_path = os.path.join(script_dir, 'index.html')
try:
- with open(template_path, 'r') as f:
+ with open(template_path, 'r', encoding='utf-8') as f:
template = f.read()
except FileNotFoundError:
print(f"Error: The template file was not found at {template_path}")
@@ -134,16 +182,14 @@ def main():
file_list_html = generate_file_list()
- # Replace the placeholder with our generated list
final_html = template.replace('<!--FILE_LIST_PLACEHOLDER-->', file_list_html)
- with open(output_path, 'w') as f:
+ with open(output_path, 'w', encoding='utf-8') as f:
f.write(final_html)
- print(f"{output_path} generated successfully.")
+ print(f"index.html generated successfully in '{output_path}'.")
finally:
- # Always change back to original directory
os.chdir(original_cwd)
if __name__ == "__main__":
diff --git a/docs/index.html b/docs/index.html
@@ -1,32 +1,69 @@
<!DOCTYPE html>
<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BSc Repository File Index</title>
<script src="https://cdn.tailwindcss.com"></script>
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
+ <link
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
+ rel="stylesheet"
+ />
+ <link
+ rel="stylesheet"
+ href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css"
+ />
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
+
<style>
- body {
- font-family: 'Inter', sans-serif;
+ body {
+ font-family: "Inter", sans-serif;
+ }
+ .chevron.rotated {
+ transform: rotate(180deg);
+ }
+ #modal-body pre {
+ max-height: 70vh;
+ }
+ /* Animation for success feedback */
+ .btn-success-pulse {
+ background-color: #10b981 !important; /* Tailwind green-500 */
+ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); /* green-500 with opacity */
+ animation: pulse-success 0.5s ease-out;
+ }
+ @keyframes pulse-success {
+ 0% {
+ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
+ }
+ 50% {
+ box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
}
- .chevron.rotated {
- transform: rotate(180deg);
+ 100% {
+ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
}
+ }
</style>
-</head>
-<body class="bg-gray-50">
+ </head>
+ <body class="bg-gray-100">
<div class="container mx-auto px-4 py-8 md:py-16">
- <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-lg overflow-hidden">
- <div class="p-8">
- <div class="text-center mb-8">
- <h1 class="text-3xl md:text-4xl font-bold text-gray-800">BSc Repository Contents</h1>
- <p class="text-gray-500 mt-2">A quick navigation guide to the files in the repository.</p>
- </div>
- <div class="space-y-4">
- <h2 class="text-lg font-semibold text-gray-700 border-b pb-2">Files and Folders</h2>
- <ul class="space-y-3">
-
+ <div
+ class="max-w-4xl mx-auto bg-white rounded-2xl shadow-lg overflow-hidden"
+ >
+ <div class="p-8">
+ <div class="text-center mb-8">
+ <h1 class="text-3xl md:text-4xl font-bold text-gray-800">
+ BSc Repository Contents
+ </h1>
+ <p class="text-gray-500 mt-2">
+ A quick navigation guide to the files in the repository.
+ </p>
+ </div>
+ <div class="space-y-4">
+ <h2 class="text-lg font-semibold text-gray-700 border-b pb-2">
+ Files and Folders
+ </h2>
+ <ul class="space-y-3">
+
<li class="border rounded-lg overflow-hidden">
<div class="folder-header bg-gray-100 p-4 cursor-pointer hover:bg-blue-100 transition-colors duration-200" onclick="toggleFolder('c')">
<div class="flex items-center justify-between">
@@ -35,8 +72,10 @@
<span class="font-medium text-gray-800">c</span>
<span class="ml-2 text-sm text-gray-500">(7 files)</span>
</div>
- <div class="flex items-center space-x-2">
- <a href="https://github.com/notamitgamer/bsc/tree/main/c" target="_blank" class="text-blue-500 font-semibold text-sm hover:underline" onclick="event.stopPropagation()">GitHub</a>
+ <div class="flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/tree/main/c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
<div class="chevron" id="chevron-c"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div>
</div>
</div>
@@ -45,59 +84,311 @@
<ul class="divide-y divide-gray-200">
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/1.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">1.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/1.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-1_c', '1.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-1_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/1.c">
+ <pre><code class="language-c">// Write a program (WAP) to print the sum and product of digits of an integer.
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+
+int main() {
+ int inp, result_sum = 0, result_product = 1, temp;
+ printf("Please enter the number : ");
+ scanf("%d",&inp);
+ printf("\n");
+
+ if (inp < 0) {
+ printf("\nPlease enter a valid non negetive integer.");
+ return 1;
+ }
+
+ temp = inp;
+ while (temp != 0 ) {
+ result_sum = result_sum + (temp % 10);
+ result_product = result_product * (temp % 10);
+ temp = temp / 10;
+ }
+
+ printf("\nSum of the digits of the input number '%d' is : %d"
+ "\nProduct of the digits of the input number '%d' is : %d",
+ inp, result_sum, inp, result_product);
+ return 0;
+}
+
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/2.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">2.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/2.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-2_c', '2.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-2_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/2.c">
+ <pre><code class="language-c">//WAP to reverse a non-negative integer.
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+
+int main() {
+ int inp, result = 0, temp;
+ printf("PLease enter the number you want to reverse : ");
+ scanf("%d",&inp);
+ printf("\n");
+
+ if (inp < 0) {
+ printf("\nPlease enter a non negetive integer.");
+ return 1;
+ }
+
+ temp = inp;
+ while ( temp != 0) {
+ result = (result * 10) + (temp % 10);
+ temp = temp / 10;
+ }
+
+ printf("\nReverse of the input '%d' is : %d", inp, result);
+ return 0;
+}
+
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/3.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">3.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/3.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-3_c', '3.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-3_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/3.c">
+ <pre><code class="language-c">// WAP to compute the sum of the first n terms of the following series S =1+1/2+1/3+1/4+......
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+
+int main() {
+ int n, i;
+ float result = 0;
+ printf("Please enter the value for 'n' : ");
+ scanf("%d", &n);
+ printf("\n");
+
+ if (n <= 0) {
+ printf("\nPlease enter a positve number greater than ZERO.");
+ return 1;
+ }
+
+ for (i = 1; i <= n; i++) {
+ result = result + (1.0 / i);
+ }
+
+ printf("\nSum of the first %d terms of the following series S =1+1/2+1/3+1/4+...... is : %f",n,result);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/4.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">4.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/4.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-4_c', '4.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-4_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/4.c">
+ <pre><code class="language-c">//WAP to compute the sum of the first n terms of the following series,S =1-2+3-4+5......
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+
+int main() {
+ int n, result = 0, temp, i;
+ printf("Please enter the value for 'n' for this series 's = 1-2+3-4+5-....': ");
+ scanf("%d",&n);
+ printf("\n");
+
+ if (n <= 0) {
+ printf("\nPlease enter a positive integer.");
+ return 1;
+ }
+
+ for (i = 1; i<= n; i++) {
+ if (i % 2 == 0) {
+ result = result - i;
+ }
+ else {
+ result = result + i;
+ }
+ }
+
+ printf("\nAns : %d", result);
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/5.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">5.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/5.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-5_c', '5.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-5_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/5.c">
+ <pre><code class="language-c">/*Write a function to find whether a given no. is prime or not.
+Use the same to generate the prime numbers less than 100.*/
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+
+int isPrime(int inp) {
+ int i, is_prime = 1;
+
+ if (inp < 2) is_prime = 0;
+
+ for (i = 2; i <= inp / 2; i++) if (inp % i == 0) {
+ is_prime = 0;
+ break;
+ }
+
+ return is_prime;
+}
+
+
+int main() {
+ int inp, i;
+ printf("Enter the number you want to check : ");
+ scanf("%d",&inp);
+ printf("\n");
+
+ if (isPrime(inp)) printf("\nGiven input '%d' is a Prime Number.",inp);
+ else printf("\nGiven input '%d' is not a Prime Number.",inp);
+
+ printf ("\nSeries of prime number upto 100 : ");
+ for (i = 2; i < 100; i++) if (isPrime(i)) printf(" %d",i);
+
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/6.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">6.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/6.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-6_c', '6.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-6_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/6.c">
+ <pre><code class="language-c">/*Write a function that checks whether a given string is Palindrome or not.
+Use this function to find whether the string entered by the user is Palindrome or not.*/
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+#include<string.h>
+
+int isPalindrome(char inp[]) {
+ int len = strlen(inp);
+ int i = 0; //starting point
+ int j = len - 1; //end point
+
+ while (i < j) {
+ if (inp[i] != inp[j]) {
+ return 0;
+ }
+ i++;
+ j--;
+ }
+
+ return 1;
+}
+
+int main() {
+ char inp[20];
+ printf("Enter the number : ");
+ scanf("%s",inp);
+ if (isPalindrome(inp)) printf("\n\nInput '%s' is a Palindrome number.", inp);
+ else printf("\n\nInput '%s' is not a Palindrome number.", inp);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/c/7.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">7.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/c/7.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-c-7_c', '7.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-c-7_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/7.c">
+ <pre><code class="language-c">// WAP to compute the factors of a given number
+// Author - Amit Dutta, Date - 13th SEP, 2025
+
+#include<stdio.h>
+#include<stdlib.h>
+
+int main() {
+ int inp, num, i;
+ printf("Please enter the number to get the factors from it : ");
+ scanf("%d", &inp);
+
+ num = abs(inp);
+
+ if (num == 0) {
+ printf("\n\n0 has infinitely many factors (all integers).");
+ return 1;
+ }
+
+ printf("\n\nThe factors of ' %d ' is :- ", inp);
+ printf("\nPositive : ");
+ for (i = 1; i <= num ; i++) if (num % i == 0) printf(" %d", i);
+ printf("\nNegative : ");
+ for (i = 1; i <= num ; i++) if (num % i == 0) printf(" %d", -i);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
</ul>
</div>
@@ -111,8 +402,10 @@
<span class="font-medium text-gray-800">letusc</span>
<span class="ml-2 text-sm text-gray-500">(42 files)</span>
</div>
- <div class="flex items-center space-x-2">
- <a href="https://github.com/notamitgamer/bsc/tree/main/letusc" target="_blank" class="text-blue-500 font-semibold text-sm hover:underline" onclick="event.stopPropagation()">GitHub</a>
+ <div class="flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/tree/main/letusc" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
<div class="chevron" id="chevron-letusc"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div>
</div>
</div>
@@ -121,339 +414,2050 @@
<ul class="divide-y divide-gray-200">
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc001.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc001.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc001_c', 'luc001.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc001_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc001.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ float f, c;
+ printf("Enter the temperature of city in Fahrenheit : ");
+ scanf("%f", &f);
+ // formula (F - 32) 5/9
+ c = ((f - 32) * 5) / 9;
+ printf("\nTemperature in centigrade : %f", c);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc002.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc002.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc002.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc002_c', 'luc002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc002.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double len, bre, r, area_r, per, area_c, cir;
+ printf("Enter the length and breadth of the rectangle : ");
+ scanf("%lf %lf", &len, &bre);
+ printf("Enter the Radius of the circle : ");
+ scanf("%lf", &r);
+ area_r = len * bre;
+ per = 2 * (len + bre);
+ area_c = M_PI * r * r;
+ cir = 2 * M_PI * r;
+ printf("\nArea of Rectangle : %lf"
+ "\nPerimeter of Rectangle : %lf"
+ "\nArea of Circle : %lf"
+ "\nCircumference of Circle : %lf",
+ area_r, per, area_c, cir);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc003.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc003.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc003.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc003_c', 'luc003.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc003_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc003.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+#include<math.h>
+int main() {
+ double s_long = 1189.0, s_short = 841.0, temp;
+ int i;
+ printf("A0 Dimension : %g mm x %g mm", floor(s_long), floor(s_short));
+ for (i = 1; i <= 8; i++) {
+ temp = s_long;
+ s_long = s_short;
+ s_short = temp / 2;
+ printf("\nA%d Dimension : %g mm x %g mm", i, floor(s_long), floor(s_short));
+ }
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc004.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc004.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc004.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc004_c', 'luc004.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc004_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc004.c">
+ <pre><code class="language-c">/* If a five digit number is input through the keyboard,
+write a program to calculate the sum of it'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 <stdio.h>
+int main()
+{
+ int inp, result = 0, i, temp;
+ printf("Enter a five digit number : ");
+ scanf("%d", &inp);
+ if (inp < 10000 || inp > 99999)
+ {
+ printf("\nPlease enter a valid five digit number.");
+ return 1;
+ }
+ temp = inp;
+ for (i = 1; i <= 5; i++)
+ {
+ result = result + (inp % 10);
+ inp = inp / 10;
+ }
+ printf("\nSum of the digit '%d' is : %d", temp, result);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc005.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc005.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc005.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc005_c', 'luc005.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc005_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc005.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double x, y, r, phi;
+ printf("Enter the Cartesian Co-Ordinates in this format 'x, y' : ");
+ scanf("%lf, %lf", &x, &y);
+ r = sqrt(pow(x, 2) + pow(y, 2));
+ phi = atan2(y, x);
+ printf("\nPolar Co-Ordinates are : (%g, %g Rad)", r, phi);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc006.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc006.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc006.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc006_c', 'luc006.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc006_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc006.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double l1, l2, g1, g2, d;
+ printf("Enter the Latitude in 'L1, L2' format : ");
+ scanf("%lf, %lf", &l1, &l2);
+ printf("Enter the Longitude in 'G1, G2' format : ");
+ scanf("%lf, %lf", &g1, &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("Distance in nautical miles : %g", d);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc007.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc007.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc007.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc007_c', 'luc007.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc007_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc007.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double t, v, wcf;
+ printf("Enter the temperature and velociy of the wind : ");
+ scanf("%lf %lf", &t, &v);
+ wcf = 35.74 + (0.6215 * t) + (((0.4275 * t) - 35.75) * pow(v, 0.16));
+ printf("\nWind-chill factor (wcf) : %g", wcf);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc008.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc008.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc008.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc008_c', 'luc008.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc008_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc008.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double inp, rsin, rcos, rtan, rcosec, rsec, rcot;
+ printf("Enter the Angle in degree : ");
+ scanf("%lf", &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("\nTrigonometric ratios :-"
+ "\nsin = %g "
+ "\ncos = %g"
+ "\ntan = %g"
+ "\ncosec = %g"
+ "\nsec = %g"
+ "\ncot = %g",
+ rsin, rcos, rtan, rcosec, rsec, rcot);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc009.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc009.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc009.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc009_c', 'luc009.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc009_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc009.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double a, b;
+ printf("Enter the two number A and B : ");
+ scanf("%lf %lf", &a, &b);
+ printf("\nBefore Interchange : ");
+ printf("\nA = %g (Memory location = %p)", a, &a);
+ printf("\nB = %g (Memory location = %p)", b, &b);
+ a = a + b;
+ b = a - b;
+ a = a - b;
+ printf("\nAfter Interchange :");
+ printf("\nA = %g (Memory location = %p)", a, &a);
+ printf("\nB = %g (Memory location = %p)", b, &b);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc010.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc010.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc010.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc010_c', 'luc010.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc010_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc010.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int num, rev, temp, i;
+ printf("Please enter the number : ");
+ scanf("%d", &num);
+ if (num < 10000 || num > 99999)
+ {
+ printf("\nPlease enter a five digit number.");
+ return 1;
+ }
+ temp = num;
+ for (i = 1; i <= 5; i++)
+ {
+ rev = (rev * 10) + num % 10;
+ num = num / 10;
+ }
+ printf("\nReverse of the Input number : %d", rev);
+ if (rev == temp)
+ printf("\nOriginal and reversed numbers are equal.");
+ else
+ printf("\nOrigianl and reversed numbers are not equal.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc011.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc011.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc011.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc011_c', 'luc011.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc011_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc011.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int ram, shyam, ajay;
+ printf("Please enter the age of Ram, Shyam and Ajay : ");
+ scanf("%d %d %d", &ram, &shyam, &ajay);
+ if (ram == shyam || ram == ajay || shyam == ajay)
+ printf("\nThree must have different age.");
+ if (ram < shyam && ram < ajay)
+ printf("\nRam is the youngest. Age : %d", ram);
+ if (shyam < ram && shyam < ajay)
+ printf("\nShyam is the youngest. Age : %d", shyam);
+ if (ajay < ram && ajay < shyam)
+ printf("\nAjay is the youngest. Age : %d", ajay);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc012.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc012.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc012.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc012_c', 'luc012.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc012_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc012.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double angle1, angle2, angle3, sum;
+ printf("Enter the value of the three angle of the triangle : ");
+ scanf("%lf %lf %lf", &angle1, &angle2, &angle3);
+ sum = angle1 + angle2 + angle3;
+ if (sum == 180.0)
+ printf("\nThis Triangle is a valid one.");
+ else
+ printf("\nThis Triangle is not valid. Sum of the angles : %g", sum);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc013.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc013.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc013.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc013_c', 'luc013.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc013_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc013.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double num;
+ printf("Enter the number : ");
+ scanf("%lf", &num);
+ num = abs(num);
+ printf("\nAbsolute value of the input is : %g", num);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc014.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc014.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc014.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc014_c', 'luc014.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc014_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc014.c">
+ <pre><code class="language-c">/* Given the length and breadth of a rectangle, write a program to find
+whether the area of the rectangle is greater than it'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 <stdio.h>
+int main()
+{
+ double len, bre, area, peri;
+ printf("Enter the length and breadth of the rectangle : ");
+ scanf("%lf %lf", &len, &bre);
+ area = len * bre;
+ peri = 2 * (len + bre);
+ if (area > peri)
+ printf("\nThe area of the rectangle is greater than it's perimeter.");
+ else if (area < peri)
+ printf("\nThe area of the rectangle is lower than it's perimeter.");
+ else
+ printf("\nThe area of the rectangle is same as it's perimeter.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc015.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc015.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc015.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc015_c', 'luc015.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc015_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc015.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+#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("Enter the point A(x1, y1) : ");
+ scanf("%lf %lf", &x1, &y1);
+ printf("Enter the point B(x2, y2) : ");
+ scanf("%lf %lf", &x2, &y2);
+ printf("Enter the point C(x3, y3) : ");
+ scanf("%lf %lf", &x3, &y3);
+ area = 0.5 * ((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2)));
+ if (fabs(area) < EPSILON) // abs() for integer, fabs() for float, double
+ printf("\nA(%g, %g), B(%g, %g) and C(%g, %g) points fall on one straight line.", x1, y1, x2, y2, x3, y3);
+ else
+ printf("\nA(%g, %g), B(%g, %g) and C(%g, %g) points doesn't fall on one straight line.", x1, y1, x2, y2, x3, y3);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc016.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc016.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc016.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc016_c', 'luc016.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc016_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc016.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+// 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("Enter the center coordinates (h, k) : ");
+ scanf("%lf %lf", &h, &k);
+ printf("Enter the radius (R) : ");
+ scanf("%lf", &R);
+ printf("Enter the point P coordinates (x, y) : ");
+ scanf("%lf %lf", &x, &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) < EPSILON)
+ {
+ printf("The point P(%g, %g) lies ON THE CIRCLE.\n", x, y);
+ }
+ // Case 2: Inside the circle (D^2 < R^2)
+ else if (distance_sq < radius_sq)
+ {
+ printf("The point P(%g, %g) lies INSIDE THE CIRCLE.\n", x, y);
+ }
+ // Case 3: Outside the circle (D^2 > R^2)
+ else
+ {
+ printf("The point P(%g, %g) lies OUTSIDE THE CIRCLE.\n", x, y);
+ }
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc017.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc017.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc017.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc017_c', 'luc017.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc017_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc017.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+#define EPSILON 0.00001
+
+int main()
+{
+ double x, y;
+ printf("Enter the point P(x, y) : ");
+ scanf("%lf %lf", &x, &y);
+ if (fabs(x) < EPSILON && fabs(y) < EPSILON)
+ printf("\nPoint P(%g, %g) lies on the origin.", x, y);
+ else if (fabs(x) < EPSILON)
+ printf("\nPoint P(%g, %g) lies on the Y-Axis.", x, y);
+ else if (fabs(y) < EPSILON)
+ printf("\nPoint P(%G, %g) lies on the X-Axis.", x, y);
+ else
+ printf("\nThe point P(%g, %g) lies in a QUADRANT (not on an axis or the origin).", x, y);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018-logic.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc018-logic.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018-logic.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc018-logic_c', 'luc018-logic.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc018-logic_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018-logic.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+
+/**
+ * @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 && 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[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+
+ printf("Enter the year (e.g., 2025): ");
+ if (scanf("%lld", &year) != 1 || year < 1) {
+ printf("Invalid year input. Please enter a positive integer year (>= 1).\n");
+ 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 < 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("\nOn January 1st, %lld, the day was: **%s**.\n", year, day_names[day_index]);
+
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc018.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc018_c', 'luc018.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc018_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc018.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+
+int is_leap(int year) {
+ if ((year % 400 == 0) || (year % 4 == 0 && 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[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+
+ printf("Enter the year (e.g., 2025): ");
+ if (scanf("%lld", &year) != 1 || year < 1) {
+ printf("Invalid year input. Please enter a positive integer year (>= 1).\n");
+ 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("\nOn January 1st, %lld, the day was: %s.\n", year, day_names[day_index]);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc019.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc019.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc019.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc019_c', 'luc019.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc019_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc019.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+
+#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("Please enter the length of three side of the triangle : ");
+ scanf("%lf %lf %lf", &side1, &side2, &side3);
+ if (side1 < 1 || side2 < 1 || side3 < 1)
+ {
+ printf("\nLength of a side of triangle should be a positive integer.");
+ return 1;
+ }
+ if (side1 + side2 < side3 || side1 + side3 < side2 || side2 + side3 < side1)
+ {
+ printf("\nEntered triangle is not VALID.");
+ return 1;
+ }
+ // isosceles check
+ if (side1 == side2 || side2 == side3 || side3 == side1)
+ printf("\nEntered triangle is a ISOSCELES triangle.");
+ else
+ printf("\nEntered triangle is NOT a ISOSCELES triangle.");
+ // equilateral check
+ if (side1 == side2 && side2 == side3)
+ printf("\nEntered triangle is a EQUILATERAL triangle.");
+ else
+ printf("\nEntered triangle is NOT a EQUILATERAL triangle.");
+ // scalene check
+ if (side1 != side2 && side2 != side3)
+ printf("\nEntered triangle is a SCALENE triangle.");
+ else
+ printf("\nEntered triangle is NOT a SCALENE triangle.");
+ // right-angle check
+ if (fabs(((side1 * side1) + (side2 * side2)) - (side3 * side3)) < EPSILON ||
+ fabs(((side2 * side2) + (side3 * side3)) - (side1 * side1)) < EPSILON ||
+ fabs(((side3 * side3) + (side1 * side1)) - (side2 * side2)) < EPSILON)
+ printf("\nEntered triangle is a RIGHT-ANGLED triangle.");
+ else
+ printf("\nEntered triangle is NOT a RIGHT-ANGLED triangle.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc020.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc020.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc020.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc020_c', 'luc020.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc020_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc020.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+
+// declaring function
+double get_white(double red, double green, double blue)
+{
+ double max;
+ max = red / 255;
+ if (max < (green / 255))
+ max = green / 255;
+ if (max < (blue / 255))
+ max = blue / 255;
+ return max;
+}
+
+int main()
+{
+ double r, g, b, w, c = 0, m = 0, y = 0, k = 0;
+ printf("Enter the RGB color code in 'R G B' format : ");
+ scanf("%lf %lf %lf", &r, &g, &b);
+
+ // checking for invalid input (negetive input)
+ if (r < 0 || g < 0 || b < 0)
+ {
+ printf("\nRGB color code can not be a negetive number.");
+ return 1;
+ }
+
+ // checking for invalid input (out of range color code)
+ if (r > 255 || g > 255 || b > 255)
+ {
+ printf("\nRGB color code can be maximum (255, 255, 255).");
+ return 1;
+ }
+
+ // converting RGB color code to CMYK color code
+ if (r == 0 && g == 0 && 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("\nRGB color (%g, %g, %g) equivalent to CMYK color (%g, %g, %g, %g).", r, g, b, c, m, y, k);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc021.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc021.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc021.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc021_c', 'luc021.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc021_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc021.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double hardness, carbon_content, tensile_strength;
+ printf("Enter the details of the steel below - \n");
+ printf("1. Hardness : ");
+ scanf("%lf", &hardness);
+ printf("2. Carbon Content : ");
+ scanf("%lf", &carbon_content);
+ printf("3. Tensile Strength : ");
+ scanf("%lf", &tensile_strength);
+
+ // storing how many conditions are met as boolean result
+ int condition_met, condition1, condition2, condition3;
+ condition1 = hardness > 50;
+ condition2 = carbon_content < 0.7;
+ condition3 = tensile_strength > 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 && condition2)
+ grade = 9;
+ else if (condition2 && condition3)
+ grade = 8;
+ else if (condition1 && condition3)
+ grade = 7;
+ }
+ else if (condition_met == 1)
+ grade = 6;
+ else
+ grade = 5;
+
+ // printing the result
+ printf("\n------------- Result -------------");
+ printf("\n1. Hardness : Condition %s", condition1 ? "MET" : "DID NOT MET");
+ printf("\n2. Carbon Content : Condition %s", condition2 ? "MET" : "DID NOT MET");
+ printf("\n3. Tensile Strength : Condition %s", condition3 ? "MET" : "DID NOT MET");
+ printf("\nTotal Condition Met : %d", condition_met);
+ printf("\n\nGrade : %d\n\n", 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. */</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc022.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc022.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc022.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc022_c', 'luc022.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc022_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc022.c">
+ <pre><code class="language-c">/* 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 < 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 >= 40
+*/
+/* Author - Amit Dutta, Date - 4th OCT, 2025 */
+/* Let Us C, Chap- 4, Page - 72, Qn No.: D(d) */
+
+#include <stdio.h>
+
+int main()
+{
+ double weight, height, bmi;
+ printf("Enter your Weight (in Kilograms) and Height (in Meters) : ");
+ scanf("%lf %lf", &weight, &height);
+ bmi = weight / (height * height);
+ printf("\nCalculated BMI : %g", bmi);
+ if (bmi < 15)
+ printf("\nBMI Catagory : Starvation");
+ else if (bmi >= 15.1 && bmi <= 17.5)
+ printf("\nBMI Catagory : Anorexic");
+ else if (bmi >= 17.6 && bmi <= 18.5)
+ printf("\nBMI Catagory : Underweight");
+ else if (bmi >= 18.6 && bmi <= 24.9)
+ printf("\nBMI Catagory : Ideal");
+ else if (bmi >= 25 && bmi <= 25.9)
+ printf("\nBMI Catagory : Overweight");
+ else if (bmi >= 30 && bmi <= 39.9)
+ printf("\nBMI Catagory : Obese");
+ else if (bmi >= 40)
+ printf("\nBMI Catagory : Morbidly Obese");
+ else
+ printf("\nBMI Catagory : Unclassified");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc023.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc023.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc023.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc023_c', 'luc023.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc023_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc023.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ char inp;
+ printf("Enter the character : ");
+ scanf("%c", &inp);
+ printf("\nInput Character '%c' is %s a LOWER CASE ALPHABET.", inp,
+ (inp >= 'a' && inp <= 'z') ? "" : "NOT");
+ printf("\nInput Character '%c' is %s a SPECIAL SYMBOL.", inp,
+ (inp >= 'a' && inp <= 'z' || inp >= 'A' && inp <= 'Z'
+ || inp >= '0' && inp <= '9') ? "NOT" : "");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc024.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc024.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc024.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc024_c', 'luc024.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc024_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc024.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int year;
+ printf("Enter the year : ");
+ scanf("%d", &year);
+ printf("\nYear %d is %s a Leapyear.", year, (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) ? "" : "NOT");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc025.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc025.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc025.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc025_c', 'luc025.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc025_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc025.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double num1, num2, num3, max;
+ printf("Enter three number : ");
+ scanf("%lf %lf %lf", &num1, &num2, &num3);
+ printf("\nGreatest of the three number '%g', '%g' and '%g' is : '%g'", num1, num2, num3,
+ (num1 > num2 && num1 > num3) ? num1 : ((num2 > num1 && num2 > num3) ? num2 : num3));
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc026.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc026.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc026.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc026_c', 'luc026.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc026_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc026.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+#define EPSILON 0.0000001
+
+int main()
+{
+ double angle, result;
+ printf("Enter the angle value in degree : ");
+ // checking if the input is other than number.
+ if(scanf("%lf", &angle) != 1) {
+ printf("\nPlease enter a number.");
+ return 1;
+ }
+ angle = angle * (M_PI / 180); // converting degree to radian
+ result = pow(sin(angle), 2) + pow(cos(angle), 2);
+ (fabs(result - 1.0) < EPSILON) ?
+ printf("\nsum of squares of sine and cosine of this angle is equal to 1.") :
+ printf("\nsum of squares of sine and cosine of this angle is NOT equal to 1.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc027.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc027.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc027.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc027_c', 'luc027.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc027_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc027.c">
+ <pre><code class="language-c">/* Rewrite the folowing program using conditional operations
+ #include<stdio.h>
+ int main()
+ {
+ float sal;
+ printf("Enter the salary");
+ scanf("%f", &sal);
+ if(sal >= 25000 && sal <= 40000)
+ printf("Manager\n");
+ else
+ if(sal >= 15000 && sal < 25000)
+ printf("Accountant\n");
+ else
+ printf("Clerk\n");
+ return 0;
+ }
+*/
+/* Author - Amit Dutta, Date - 6th OCT, 2025 */
+/* Let Us C, Chap- 4, Page - 73, Qn No.: E(e) */
+
+#include <stdio.h>
+int main()
+{
+ float sal;
+ printf("Enter the salary");
+ scanf("%f", &sal);
+ (sal >= 25000 && sal <= 40000) ? printf("Manager\n") :
+ ((sal >= 15000 && sal < 25000) ? printf("Accountant\n") : printf("Clerk\n"));
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc028.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc028.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc028.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc028_c', 'luc028.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc028_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc028.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int i = 0;
+ printf("ASCII Value\tCharacter");
+ printf("\n-----------\t---------\n");
+ while (i <= 255)
+ {
+ printf("%d.\t%c\n\n", i, i);
+ i++;
+ }
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc029.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc029.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc029.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc029_c', 'luc029.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc029_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc029.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ int num = 100, temp1, temp2, res;
+ printf("Armstrong numbers between 100 and 500 :");
+ while (num <= 500)
+ {
+ temp1 = num;
+ res = 0;
+ while (temp1 != 0)
+ {
+ temp2 = temp1 % 10;
+ res = res + pow(temp2, 3);
+ temp1 = temp1 / 10;
+ }
+ if (num == res)
+ printf(" %d", num);
+ num++;
+ }
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc030.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc030.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc030.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc030_c', 'luc030.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc030_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc030.c">
+ <pre><code class="language-c">/* 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's pick and the
+computer's pick equal to 5 in each round. This forces the player
+to pick the final matchstick. */
+
+#include <stdio.h>
+int main()
+{
+ int remaining_matchsticks = 21, player_pick, computer_pick;
+ printf(" --- Matchstick Game ---\n");
+ printf("Rules: There are 21 matchsticks. You can pick 1, 2, 3, or 4.\n");
+ printf("Whoever is forced to pick the last matchstick loses the game.\n");
+ while (remaining_matchsticks > 1)
+ {
+ // game start
+ printf("\n--------------------------");
+ printf("\nRemaining Matchsticks : %d", remaining_matchsticks);
+
+ // player pick and checking input is valid or not
+ printf("\nYour turn: Pick 1, 2, 3, or 4 matchsticks: ");
+ if (scanf("%d", &player_pick) != 1)
+ {
+ printf("\n\tPlease enter a number.");
+ while (getchar() != '\n')
+ ;
+ continue;
+ }
+
+ // checking player pick is valid or not
+ if (player_pick < 1 || player_pick > 4)
+ {
+ printf("\n\tPlease enter a number among 1, 2, 3 and 4.");
+ while (getchar() != '\n')
+ ;
+ continue;
+ }
+
+ if (player_pick > remaining_matchsticks)
+ {
+ printf("\nInvalid choice! There are not enough matchsticks left.");
+ while (getchar() != '\n')
+ ;
+ continue;
+ }
+
+ // computer_picks
+ computer_pick = 5 - player_pick;
+ printf("\ncomputer_picks : %d", computer_pick);
+
+ // remaining matchsticks
+ remaining_matchsticks = remaining_matchsticks - (player_pick + computer_pick);
+ }
+
+ // game over
+ printf("\n----------------------------------\n");
+ printf("Only 1 matchstick is left.\n");
+ printf("You are forced to pick the last matchstick. You lose!\n");
+ printf("The computer wins.\n");
+
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031-logic.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc031-logic.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031-logic.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc031-logic_c', 'luc031-logic.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc031-logic_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031-logic.c">
+ <pre><code class="language-c">/* 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's input as a generic string (char array).
+ * This allows the program to accept multi-digit numbers (e.g., "-500") or the command ('n').
+ * 4. TERMINATION CHECK: Immediately check if the input string is exactly "n" using strcmp().
+ * If true, the user wants to quit, so break the loop.
+ * 5. VALIDATION & CONVERSION: If the input is not "n", 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 > 0, increment positive_count.
+ * - If the number is < 0, increment negative_count.
+ * - If the number is == 0, increment zero_count.
+ * 7. ERROR HANDLING: If the input is neither "n" 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 <stdio.h>
+#include <stdlib.h> // for strtol
+#include <string.h> // 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's input as a string (e.g., "123", "-50", or "n")
+ char input_buffer[MAX_INPUT_LEN];
+ int number;
+
+ printf("--- Number Analyzer ---\n");
+ printf("Enter numbers one by one. Type 'n' and press Enter to finish.\n\n");
+
+ // Loop until the user enters 'n'
+ while (1) {
+ printf("Enter number or 'n': ");
+
+ // 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 '\n' if the input was shorter than MAX_INPUT_LEN
+ size_t len = strlen(input_buffer);
+ if (len > 0 && input_buffer[len - 1] == '\n') {
+ input_buffer[len - 1] = '\0';
+ }
+
+ // 1. Check for the termination condition
+ if (strcmp(input_buffer, "n") == 0) {
+ printf("\n'n' received. Stopping input...\n");
+ 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 "%d" (decimal integer)
+ // It returns 1 if a number was successfully read.
+ int conversions = sscanf(input_buffer, "%d", &number);
+
+ if (conversions == 1) {
+ // Conversion was successful, now check the number's sign
+ if (number > 0) {
+ positive_count++;
+ } else if (number < 0) {
+ negative_count++;
+ } else {
+ zero_count++;
+ }
+ printf(" -> Number recorded: %d\n", number);
+ } else {
+ // Conversion failed. The input was neither 'n' nor a valid integer.
+ printf(" -> Invalid input. Please enter a valid number or 'n'.\n");
+ }
+ }
+
+ // Display the final results
+ printf("\n====================================\n");
+ printf(" Analysis Complete\n");
+ printf("====================================\n");
+ printf("Positive numbers entered: %d\n", positive_count);
+ printf("Negative numbers entered: %d\n", negative_count);
+ printf("Zeroes entered: %d\n", zero_count);
+ printf("Total numbers recorded: %d\n", positive_count + negative_count + zero_count);
+ printf("====================================\n");
+
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc031.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc031_c', 'luc031.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc031_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc031.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int choice = 1, num, positive_count = 0, negative_count = 0, zero_count = 0;
+ while (choice == 1)
+ {
+ printf("\nEnter the number (Type any character and press Enter to finish.) : ");
+ choice = scanf("%d", &num); // Checking whether the user has input any characters
+ if (choice == 1)
+ {
+ printf("Number recorded : %d", num);
+ if (num < 0)
+ negative_count++;
+ else if (num > 0)
+ positive_count++;
+ else if (num == 0)
+ zero_count++;
+ }
+ else
+ {
+ // If the user inputs any characters, then choice = 0, it means he doesn't want to give any more input;
+ choice = 0;
+ printf("\nCharacter received. Stopping input...\n");
+ }
+ }
+ // Display the final results
+ printf("\n====================================\n");
+ printf(" Analysis Complete\n");
+ printf("====================================\n");
+ printf("Positive numbers entered: %d\n", positive_count);
+ printf("Negative numbers entered: %d\n", negative_count);
+ printf("Zeroes entered: %d\n", zero_count);
+ printf("Total numbers recorded: %d\n", positive_count + negative_count + zero_count);
+ printf("====================================\n");
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc032.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc032.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc032.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc032_c', 'luc032.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc032_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc032.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int octal[20], decimal, index = 0, temp, rem;
+ printf("Enter the decimal number : ");
+ scanf("%d", &decimal);
+ temp = decimal;
+ while (temp != 0)
+ {
+ rem = temp % 8;
+ temp = temp / 8;
+ octal[index] = rem;
+ index++;
+ }
+ printf("\nDeciaml %d to octal : ", decimal);
+ while ((index - 1) >= 0)
+ {
+ printf("%d", octal[index - 1]);
+ index--;
+ }
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc033.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">luc033.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc033.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc033_c', 'luc033.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc033_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc033.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int choice = 1, set_of_numbers[30], num, index = -1;
+ while (choice == 1)
+ {
+ printf("\nEnter the number (Type any character and press Enter to finish.) : ");
+ choice = scanf("%d", &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't want to give any more input;
+ choice = 0;
+ printf("\nCharacter received. Stopping input...\n");
+ break;
+ }
+ index++;
+ set_of_numbers[index] = num;
+ }
+ int max = set_of_numbers[0], min = set_of_numbers[0];
+ while (index >= 0)
+ {
+ if (max < set_of_numbers[index])
+ max = set_of_numbers[index];
+ if (min > set_of_numbers[index])
+ min = set_of_numbers[index];
+ index--;
+ }
+ int range = max - min;
+ printf("\nBiggest number in the set : %d", max);
+ printf("\nSmallest number in the set : %d", min);
+ printf("\nRange : %d", range);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem001.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem001_c', 'lucproblem001.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem001_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int n, nonotes, temp;
+ printf("Enter the amount : ");
+ scanf("%d", &n);
+ if (n < 1)
+ {
+ printf("\nAmount should be a positive integer.");
+ 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("\nthe smallest number of notes that will combine to give Rs. %d : %d", temp, nonotes);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem002.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem002.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem002.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem002_c', 'lucproblem002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem002.c">
+ <pre><code class="language-c">/* A year is entered through the keyboard, write a program to
+determine whether the year is leap or not. Use the logical operators
+&& and || . */
+/* Author - Amit Dutta, Date - 02th OCT, 2025 */
+/* Let Us C, Chap - 4, Page - 64, Problem 4.1 */
+
+#include <stdio.h>
+int main()
+{
+ int year;
+ printf("Enter year : ");
+ scanf("%d", &year);
+ if (year % 4 == 0 && year & 100 != 0 || year % 400 == 0)
+ printf("\nYear %d is a leapyear.", year);
+ else
+ printf("\nYear %d is not a leapyear.", year);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem003.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem003.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem003.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem003_c', 'lucproblem003.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem003_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem003.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ char inp;
+ printf("Enter one character : ");
+ scanf(" %c", &inp);
+ if (inp >= 64 && inp <= 90)
+ printf("\nInput '%c' is a CAPITAL LETTER.", inp);
+ if (inp >= 97 && inp <= 122)
+ printf("\nInput '%c' is a SMALL CASE LETTER.", inp);
+ if (inp >= 48 && inp <= 57)
+ printf("\nInput '%c' is a DIGIT.", inp);
+ if (inp >= 0 && inp <= 47 || inp >= 58 && inp <= 64
+ || inp >= 91 && inp <= 96 || inp >= 123 && inp <= 127)
+ printf("\nInput '%c' is a SPECIAL SYMBOL.", inp);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem004.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem004.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem004.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem004_c', 'lucproblem004.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem004_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem004.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double side1, side2, side3;
+ printf("Enter the length of side1, side2 and side3 of the triangle : ");
+ scanf("%lf %lf %lf", &side1, &side2, &side3);
+ if (side1 <= 0 || side2 <= 0 || side3 <= 0)
+ {
+ printf("\nTriangle sides must be positive.\n");
+ return 1;
+ }
+ if ((side1 + side2 > side3) && (side1 + side3 > side2) && (side2 + side3 > side1))
+ // Triangle Inequality Theorem
+ printf("\nThis triangle is valid.");
+ else
+ printf("\nThis triangle is not valid.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem005.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem005.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem005.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem005_c', 'lucproblem005.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem005_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem005.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <conio.h>
+int main()
+{
+ int working_hour, i = 1;
+ double pay;
+ while (i <= 10)
+ {
+ printf("Enter the working hour for the employee no. %d : ", i);
+ if (scanf("%d", &working_hour) != 1)
+ {
+ printf("\n\tPlease enter a number as woking hour.\n\n");
+ while (getchar() != '\n')
+ ;
+ // above line discard the input characters untill getchar() reaches the new line character.
+ /* if I do not discard the input, after 'continue;' 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 > 40)
+ {
+ pay = (working_hour - 40) * 120.00;
+ printf("\n\tOvertime working hours of Employee %d : %d", i, (working_hour - 40));
+ printf("\n\tPay of the overtime for Employee %d : Rs. %.2f\n\n", i, pay);
+ }
+ else
+ printf("\n\tEmployee %d did not work any overtime.\n\n", i);
+ i++; // changing to next employee
+ }
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem006.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem006.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem006.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem006_c', 'lucproblem006.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem006_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem006.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int num, i = 1;
+ long long fact = 1;
+ printf("Enter the number : ");
+ // checking if the input is valid or not
+ if (scanf("%d", &num) != 1)
+ {
+ printf("\nPlease enter a number.");
+ return 1;
+ }
+ // result for the negetive input
+ if (num < 0)
+ {
+ printf("\nFactorial of %d : Undefined", num);
+ return 1;
+ }
+ // Hard codded result for input '0' (zero)
+ if (num == 0)
+ {
+ printf("\nFactorial of 0 : 1");
+ return 0;
+ }
+ // calculating result
+ while (i <= num) {
+ fact = fact * i;
+ i++;
+ }
+ printf("\nFactorial of %d : %d", num, fact);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem007.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem007.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem007.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-lucproblem007_c', 'lucproblem007.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-lucproblem007_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem007.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double num, result;
+ int power, i = 1;
+ printf("Enter the numbers in 'num^power' format : ");
+ // checking if the input is valid or not
+ if (scanf("%lf^%d", &num, &power) != 2)
+ {
+ printf("\nPlease enter numbers.");
+ return 1;
+ }
+ // result for the negetive input
+ if (power < 0)
+ {
+ printf("\nPlease use a positive number as power.");
+ return 1;
+ }
+ // Hard codded result for input '0' (zero)
+ if (power == 0)
+ {
+ printf("\n%g to the power of %d is : 1", num, power);
+ return 0;
+ }
+ result = num;
+ while (i <= power - 1)
+ {
+ result = result * num;
+ i++;
+ }
+ printf("\n%g to the power of %d is : %g", num, power, result);
+ return 0;
+}</code></pre>
+ </div>
</li>
</ul>
</div>
@@ -467,8 +2471,10 @@
<span class="font-medium text-gray-800">tuition-c</span>
<span class="ml-2 text-sm text-gray-500">(53 files)</span>
</div>
- <div class="flex items-center space-x-2">
- <a href="https://github.com/notamitgamer/bsc/tree/main/tuition-c" target="_blank" class="text-blue-500 font-semibold text-sm hover:underline" onclick="event.stopPropagation()">GitHub</a>
+ <div class="flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/tree/main/tuition-c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
<div class="chevron" id="chevron-tuition-c"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div>
</div>
</div>
@@ -477,453 +2483,2144 @@
<ul class="divide-y divide-gray-200">
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-001.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-001.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-001_c', 'APC-PRAC-001.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-001_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-001.c">
+ <pre><code class="language-c">/* WAP to calculate area and perimeter of a rectangle
+by accepting length and breadth as input. */
+// Author - Amit Dutta, Date - 18th SEP, 2025
+
+#include<stdio.h>
+int main() {
+ double length, breadth, area, perimeter;
+ printf("Enter the length and breadth of the Rectangle : ");
+ scanf("%lf %lf", &length, &breadth);
+ area = length * breadth;
+ perimeter = 2 * (length + breadth);
+ printf("\nArea of the Rectangle : %g"
+ "\nPerimeter of the Rectangle : %g", area, perimeter);
+ return 0;
+
+}
+
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-002.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-002.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-002.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-002_c', 'APC-PRAC-002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-002.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double r, area;
+ printf("Enter the radius of the circle : ");
+ scanf("%lf", &r);
+ area = M_PI * pow(r, 2);
+ printf("\nArea of the circle : %g", area);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-003.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-003.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-003.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-003_c', 'APC-PRAC-003.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-003_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-003.c">
+ <pre><code class="language-c">/* WAP to accept diagonal of a square and calculate area, parimeter */
+/* Author - Amit Dutta, Date - 18th SEP, 2025 */
+
+#include <stdio.h>
+#include <math.h>
+int main()
+{
+ double dia, side, area, peri;
+ printf("Enter the diagonal of the square : ");
+ scanf("%lf", &dia);
+ side = dia / sqrt(2);
+ area = pow(side, 2);
+ peri = 4 * side;
+ printf("\nArea of the square : %g"
+ "\nPerimeter of the square : %g",
+ area, peri);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-004.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-004.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-004.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-004_c', 'APC-PRAC-004.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-004_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-004.c">
+ <pre><code class="language-c">/* WAP to calculate and display radius of a circle by taking the area as input. */
+/* Author - Amit Dutta, Date - 18th SEP, 2025 */
+
+#include <stdio.h>
+#include <math.h>
+int main()
+{
+ double r, area;
+ printf("Enter the area of the circle : ");
+ scanf("%lf", &area);
+ r = sqrt(area / M_PI);
+ printf("\nRadius of the circle : %g", r);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-005.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-005.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-005.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-005_c', 'APC-PRAC-005.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-005_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-005.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int days, months, years, temp;
+ printf("Enter the No. of days : ");
+ scanf("%d", &days);
+ temp = days;
+ years = days / 365;
+ days = days % 365;
+ months = days / 30;
+ days = days % 30;
+ printf("%d Days = %d Years, %d Months, %d Days", temp, years, months, days);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-006.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-006.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-006.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-006_c', 'APC-PRAC-006.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-006_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-006.c">
+ <pre><code class="language-c">/* WAP that accept seconds as input and represent it an hours, minutes and seconds. */
+/* Author - Amit Dutta, Date - 19th SEP, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int sec, hours, minutes, temp;
+ printf("Enter the no of seconds : ");
+ scanf("%d", &sec);
+ temp = sec;
+ hours = sec / 3600;
+ sec = sec % 3600;
+ minutes = sec / 60;
+ sec = sec % 60;
+ printf("\n%d Seconds = %d Hours, %d Minutes, %d Seconds.", temp, hours, minutes, sec);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-007.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-007.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-007.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-007_c', 'APC-PRAC-007.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-007_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-007.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double bs, gs, ns, da, hra, pf;
+ printf("Enter the basic salary of the employee : ");
+ scanf("%lf", &bs);
+ da = bs * 0.25;
+ hra = bs * 0.125;
+ pf = bs * 0.10;
+ gs = bs + da + hra;
+ ns = gs - pf;
+ printf("\nGross Salary : %g"
+ "\nNet Salary : %g",
+ gs, ns);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-008.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-008.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-008.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-008_c', 'APC-PRAC-008.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-008_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-008.c">
+ <pre><code class="language-c">/* WAP to multiply and divide a number by 4 without
+using multiplication and division operator. */
+/* Author - Amit Dutta, Date - 19th SEP, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int num, multi, div;
+ printf("Enter the number : ");
+ scanf("%d", &num);
+ multi = num << 2;
+ div = num >> 2;
+ printf("Multiplication : %d"
+ "\nDivision : %d",
+ multi, div);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-009.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-009.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-009.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-009_c', 'APC-PRAC-009.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-009_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-009.c">
+ <pre><code class="language-c">/* WAP to swap two integer variable without using Third variable. */
+/* Author - Amit Dutta, Date - 19th SEP, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int a = 4, b = 6;
+ printf("Before swap : A = %d and B = %d", a, b);
+ a = a ^ b;
+ b = a ^ b;
+ a = a ^ b;
+ printf("\nAfter swap : A = %d and B = %d", a, b);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-010.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-PRAC-010.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-010.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-PRAC-010_c', 'APC-PRAC-010.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-010_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-010.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ double a, b, c, result;
+ printf("Enter the value for a, b and c : ");
+ scanf("%lf %lf %lf", &a, &b, &c);
+ result = (1 / pow(a, 3)) + (1 / pow((b + 2), 3)) + (1 / (pow(c, 4) + sqrt(2)));
+ printf("\nResult = %g", result);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-001.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-S-001.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-S-001_c', 'APC-S-001.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-S-001_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-001.c">
+ <pre><code class="language-c">#include<stdio.h>
+int main() {
+ int a = 9, b = 4, c;
+ c = a + b;
+ printf("A + B = %d\n", c);
+ c = a / b;
+ printf("A / B = %d\n", c);
+ c = a % b;
+ printf("A %% B = %d\n", c);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-002.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-S-002.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-002.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-S-002_c', 'APC-S-002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-S-002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-002.c">
+ <pre><code class="language-c">#include<stdio.h>
+int main() {
+ int a = 5, b = 5, c = 10;
+ printf("a = b = %d\n", a == b);
+ printf("a > b = %d\n", a > b);
+ printf("a < b = %d\n", a < b);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-003.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-S-003.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-003.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-S-003_c', 'APC-S-003.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-S-003_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-003.c">
+ <pre><code class="language-c">#include <stdio.h>
+int main() {
+ int a = 5, b = 5, c = 10, result;
+
+ result = (a == b) && (c > b);
+ printf("Result is %d\n", result);
+
+ result = (a == b) && (c < b);
+ printf("Result is %d\n", result);
+
+ result = (a != b) || (c < b);
+ printf("Result is %d\n", result);
+
+ result = (a != b) || (c < b);
+ printf("Result is %d\n", result);
+
+ result = !(a != b);
+ printf("Result is %d\n", result);
+
+ result = !(a == b);
+ printf("Result is %d\n", result);
+
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-001.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-001.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-001_c', 'APC-SPS-001.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-001_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-001.c">
+ <pre><code class="language-c">// WAP to perform arithmatic operation on integer data
+
+#include<stdio.h>
+int main() {
+ int a, b, sum, sub, multi, div, mod;
+ printf("Enter 1st number : ");
+ scanf("%d", &a);
+ printf("Enter 2nd number : ");
+ scanf("%d", &b);
+ sum = a + b;
+ sub = a - b;
+ multi = a * b;
+ div = a / b;
+ mod = a % b;
+ printf("\nSum = %d", sum);
+ printf("\nSubtraction = %d", sub);
+ printf("\nMultiplication = %d", multi);
+ printf("\nDivision = %d", div);
+ printf("\nModulas = %d", div);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-002.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-002.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-002.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-002_c', 'APC-SPS-002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-002.c">
+ <pre><code class="language-c">/* WAP to swap two integers. Display both numbers
+before and after swap */
+
+#include<stdio.h>
+int main() {
+ int a = 10, b = 20, temp;
+ printf("Before swap A : %d, B : %d", a, b);
+ temp = a;
+ a = b;
+ b = temp;
+ printf("\nAfter swap A : %d, B : %d", a, b);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-003.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-003.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-003.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-003_c', 'APC-SPS-003.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-003_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-003.c">
+ <pre><code class="language-c">/* Bitwise AND '&' */
+
+#include<stdio.h>
+int main() {
+ unsigned int a = 4, b = 5, c = 6;
+ unsigned int x, y;
+ x = a & b;
+ y = b & c;
+ printf("x = %u y = %u", x, y);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-004.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-004.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-004.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-004_c', 'APC-SPS-004.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-004_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-004.c">
+ <pre><code class="language-c">#include<stdio.h>
+int main() {
+ int x = 25, y = 19, z;
+ z = x - y;
+ z = z & x ;
+ printf("Z = %d", z);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-005.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-005.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-005.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-005_c', 'APC-SPS-005.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-005_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-005.c">
+ <pre><code class="language-c">/* Bitwise OR '|' */
+
+#include<stdio.h>
+int main() {
+ int x = 12, y = 14, z = 10, res;
+ x++;
+ z++;
+ x = x + y + z;
+ res = x | y;
+ z = res | z;
+ printf("x = %d y = %d z = %d res = %d", x, y, z, res);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-006.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-006.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-006.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-006_c', 'APC-SPS-006.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-006_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-006.c">
+ <pre><code class="language-c">/* Bitwise NOT '~' */
+
+#include<stdio.h>
+int main() {
+ int x = 12, y = 15, z = 21;
+ int res, res1, res2;
+ res = x > 10;
+ res1 = ~res;
+ res2 = ~x;
+ printf("REs = %d, Res1 = %d, Res2 = %d", res, res1, res2);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-007.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-007.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-007.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-007_c', 'APC-SPS-007.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-007_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-007.c">
+ <pre><code class="language-c">/* WAP to check a number is even or odd using bitwise operator */
+
+#include<stdio.h>
+int main() {
+ int x, res = 1;
+ printf("Enter a number : ");
+ scanf("%d", &x);
+ res = res & x;
+ if (res == 0) {
+ printf("\nInput %d is a even number.", x);
+ }
+ else {
+ printf("\nInput %d is a odd number.", x);
+ }
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-008.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">APC-SPS-008.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-008.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-APC-SPS-008_c', 'APC-SPS-008.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-SPS-008_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-008.c">
+ <pre><code class="language-c">/* WAP to calculate area of circle by accepting radius as input */
+/* Author : Amit Dutta, Date : 15th September, 2025 */
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double r, area;
+ printf("Enter the radius of circle : ");
+ scanf("%lf", &r);
+ area = M_PI * r * r;
+ printf("\nArea : %lf", area);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P001.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P001.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P001_c', 'P001.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P001_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P001.c">
+ <pre><code class="language-c">//sample code
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+int main() {
+ printf("Hello world");
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P002.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P002.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P002.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P002_c', 'P002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P002.c">
+ <pre><code class="language-c">//sample code with a new line charecter
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+int main() {
+ printf("Hello\nworld");
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P003.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P003.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P003.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P003_c', 'P003.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P003_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P003.c">
+ <pre><code class="language-c">//WAP to perform addtion and multiplication of two integer numbers
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+int main() {
+ int a, b, sum, multi;
+ printf("Enter the 1st number : ");
+ scanf("%d",&a);
+ printf("Enter the 2nd number : ");
+ scanf("%d",&b);
+ sum = a + b;
+ multi = a * b;
+ printf("\nSum = %d"
+ "\nMultiplication = %d",sum,multi);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P004.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P004.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P004.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P004_c', 'P004.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P004_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P004.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ double x =5, result;
+ result = ((x + 3) / 4) - ((2 * x + 4) / 3);
+ printf("Result = %lf",result);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P005.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P005.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P005.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P005_c', 'P005.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P005_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P005.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ int daily_wage = 455, fine = 150, present, absent, income;
+ printf("No of days present : ");
+ scanf("%d", &present);
+ absent = 30 - present;
+ income = (present * 455) - (absent * 150);
+ printf("\nIncome : %d",income);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P006.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P006.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P006.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P006_c', 'P006.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P006_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P006.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ double f = 98.6, c;
+ c = ((f - 32) * 5) / 9;
+ printf("Temperature in Celcius is : %lf",c);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P007.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P007.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P007.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P007_c', 'P007.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P007_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P007.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ double mrp, final_price, temp;
+ printf("Enter the printed price : ");
+ scanf("%lf", &mrp);
+ temp = mrp * 0.90;
+ final_price = temp * 1.06;
+ printf("\nCustomer have to pay : %lf", final_price);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P008.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P008.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P008.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P008_c', 'P008.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P008_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P008.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ double mrp, shop1, shop2, temp;
+ printf("Enter the price : ");
+ scanf("%lf", &mrp);
+ shop1 = mrp * 0.70;
+ temp = mrp * 0.80;
+ shop2 = temp * 0.90;
+ printf("\nShopkeeper 1 price : %lf"
+ "\nShopkeeper 2 price : %lf",shop1,shop2);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P009.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P009.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P009.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P009_c', 'P009.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P009_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P009.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+int main() {
+ double bs, da, hra, pf, gs, ns;
+ printf("Enter the Basic Salary : ");
+ scanf("%lf", &bs);
+ da = bs * 0.3;
+ hra = bs * 0.2;
+ pf = bs * 0.125;
+ gs = bs + da + hra;
+ ns = gs - pf;
+ printf("\nGross Salary : %lf"
+ "\nNet Salary : %lf", gs, ns);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P010.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P010.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P010.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P010_c', 'P010.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P010_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P010.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+#include<math.h>
+int main() {
+ double p, r, t, si, a, ci, dif;
+ printf("Enter the principle amount, rate of interest, time in year : ");
+ scanf("%lf %lf %lf", &p, &r, &t);
+ si = (p * r * t) / 100;
+ a = p * pow((1 + (r / 100)), t);
+ ci = a - p;
+ dif = ci - si;
+ printf("\nSimple Interest : %lf"
+ "\nCompound Interest : %lf"
+ "\nInterest Difference : %lf", si, ci, dif);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P011.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P011.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P011.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P011_c', 'P011.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P011_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P011.c">
+ <pre><code class="language-c">/* 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<stdio.h>
+#include<math.h>
+int main() {
+ double l, g, t;
+ printf("Enter the Length and Gravity measures : ");
+ scanf("%lf %lf", &l, &g);
+ t = 2 * M_PI * sqrt(l / g);
+ // using M_PI variable for PI value from math.h header file
+ printf("\nTime Period : %lf", t);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P012.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P012.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P012.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P012_c', 'P012.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P012_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P012.c">
+ <pre><code class="language-c">/* WAP to swap two integer variable without
+using third variable */
+// using Approch Mode : simple, slow, time consuming
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+int main() {
+ int a = 4, b = 6;
+ printf("Before Swap : A = %d, B = %d", a, b);
+ a = a + b;
+ b = a - b;
+ a = a - b;
+ printf("\nAfter Swap : A = %d, B = %d", a, b);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P013.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P013.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P013.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P013_c', 'P013.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P013_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P013.c">
+ <pre><code class="language-c">/* WAP to swap two integer variable without
+using third variable */
+// using Approch Mode : complex, fast, less time consumimg
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ int a = 4, b = 6;
+ printf("Before Swap : A = %d, B = %d", a, b);
+ a = a ^ b;
+ b = a ^ b;
+ a = a ^ b;
+ printf("\nAfter Swap : A = %d, B = %d", a, b);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P014.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P014.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P014.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P014_c', 'P014.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P014_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P014.c">
+ <pre><code class="language-c">/* WAP to accept the diagonal of
+square. Find and display the area and
+perimeter of the square. */
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double d, side, area, per;
+ printf("Enter the diagonal : ");
+ scanf("%lf", &d);
+ side = d / sqrt (2);
+ area = side * side;
+ per = 4 * side;
+ printf("\nArea of the Square : %lf"
+ "\nPerimeter of the Square : %lf", area, per);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P015.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P015.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P015.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P015_c', 'P015.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P015_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P015.c">
+ <pre><code class="language-c">/*WAP to accept number of days and
+display it after converting into
+number of years, months and days */
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+int main() {
+ int day, month, year, temp;
+ printf("Enter the number of days : ");
+ scanf("%d", &day);
+ temp = day;
+ year = day / 365;
+ day = day % 365;
+ month = day / 30;
+ day = day % 30;
+ printf("\n%d Days = %d Years %d Months %d Days", temp, year, month, day);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P016.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P016.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P016.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P016_c', 'P016.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P016_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P016.c">
+ <pre><code class="language-c">/* WAP to calculate and display radius of a
+circle by taking the area as input */
+// Author - Amit Dutta, Date - Unknown
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double area, r;
+ printf("Enter the area of a circle : ");
+ scanf("%lf", &area);
+ r = sqrt((7 * area) / 22);
+ printf("\nRadius : %lf", r);
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P017.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P017.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P017.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P017_c', 'P017.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P017_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P017.c">
+ <pre><code class="language-c">/* Find maximum between three number. */
+// Author - Amit Dutta, Date - Unknown
+
+#include <stdio.h>
+int main()
+{
+ int a, b, c, max;
+ printf("Enter the value for a, b, c : ");
+ scanf("%d %d %d", &a, &b, &c);
+ max = a;
+ if (max < b)
+ max = b;
+ if (max < c)
+ max = c;
+ printf("Maximum : %d", max);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P018.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P018.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P018.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P018_c', 'P018.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P018_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P018.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double cost, sell, pro, prop, loss, lossp;
+ printf("Enter the cost and selling price : ");
+ scanf("%lf %lf", &cost, &sell);
+ if (sell > cost)
+ {
+ pro = sell - cost;
+ prop = (pro / cost) * 100;
+ printf("Profit : RS %g, Profit Percentage : %g", pro, prop);
+ }
+ else if (sell < cost)
+ {
+ loss = cost - sell;
+ lossp = (loss / cost) * 100;
+ printf("Loss : RS %g, Loss Percentage : %g", loss, lossp);
+ }
+ else
+ printf("Neither loss nor Profit.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P019.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P019.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P019.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P019_c', 'P019.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P019_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P019.c">
+ <pre><code class="language-c">/* WAP to input the distance covered and calculate
+the amount to be paid by the passanger.
+ Distance Rate
+ =<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 <stdio.h>
+int main()
+{
+ double dis, amt;
+ printf("Enter the distance : ");
+ scanf("%lf", &dis);
+ if (dis <= 5.0)
+ amt = 90.0;
+ else if (dis > 5.0 && dis <= 15.0)
+ amt = 90.0 + (dis - 5.0) * 20;
+ else if (dis > 15.0 && dis <= 25.0)
+ amt = 90.0 + 200.0 + (dis - 15.0) * 10;
+ else if (dis > 25.0)
+ amt = 90.0 + 200.0 + 100.0 + (dis - 25.0) * 9;
+ printf("\nAmount to be paid : %g", amt);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P020.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P020.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P020.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P020_c', 'P020.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P020_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P020.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double nod, amt, s, i;
+ printf("Enter the amount and the time in days : ");
+ scanf("%lf %lf", &s, &nod);
+ if (nod <= 180)
+ i = (s * 5.5 * (nod / 365)) / 100;
+ else if (nod > 180.0 && nod <= 364.0)
+ i = (s * 7.5 * (nod / 365)) / 100;
+ else if (nod == 365.0)
+ i = (s * 9.0 * 1) / 100;
+ else if (nod > 365.0)
+ i = (s * 8.5 * (nod / 365)) / 100;
+ amt = s + i;
+ printf("Amount to be paid : %g", amt);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P021.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P021.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P021.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P021_c', 'P021.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P021_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P021.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+#include <math.h>
+int main()
+{
+ int n, temp;
+ double sr;
+ printf("Enter the number : ");
+ scanf("%d", &n);
+ sr = sqrt(n);
+ temp = (int)sr;
+ if (temp * temp == n)
+ printf("\nThis is a perfect square.");
+ else
+ printf("\nThis is not a perfect square.");
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P022.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P022.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P022.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P022_c', 'P022.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P022_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P022.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int a, b, c, min;
+ printf("Enter three number : ");
+ scanf("%d %d %d", &a, &b, &c);
+ min = (a < b && a < c) ? a : (b < a && b < c) ? b
+ : c;
+ printf("Minimum = %d", min);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P023.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P023.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P023.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P023_c', 'P023.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P023_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P023.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double cost, amt;
+ printf("Enter the total cost : ");
+ scanf("%lf", &cost);
+ if (cost <= 2000)
+ amt = cost * 0.94;
+ else if (cost > 2000 && cost <= 5000)
+ amt = cost * 0.9;
+ else if (cost > 5000 && cost <= 10000)
+ amt = cost * 0.85;
+ else if (cost > 10000)
+ amt = cost * 0.8;
+ printf("\nAmount to be paid : %g", amt);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P024.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P024.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P024.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P024_c', 'P024.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P024_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P024.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int year;
+ printf("Enter the year : ");
+ scanf("%d", &year);
+ if (year % 4 == 0 && year % 100 != 0)
+ printf("\nYear %d is a leapyear.", year);
+ else if (year % 400 == 0)
+ printf("\nYear %d is a leapyear (Century).", year);
+ else
+ printf("\nYear %d is not a leapyear.", year);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P025.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P025.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P025.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P025_c', 'P025.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P025_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P025.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ double unit, amt;
+ printf("Enter the electricity consp(unit) : ");
+ scanf("%lf", &amt);
+ if (unit <= 50)
+ amt = unit * 0.50;
+ else if (unit > 50 && unit <= 50)
+ amt = 25 + ((unit - 50) * 0.75);
+ else if (unit > 150 && unit <= 250)
+ amt = 25 + 75 + ((unit - 150) * 1.20);
+ else if (unit > 250)
+ amt = 25 + 75 + 120 + ((unit - 250) * 1.50);
+ amt = amt * 1.20;
+ printf("\nAmount to be paid : %g", amt);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P026.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P026.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P026.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P026_c', 'P026.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P026_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P026.c">
+ <pre><code class="language-c">/* WAP to input sum (p), rate of interest (r), time (t) and type of interest
+('s' for simple interest amd 'c' 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 <stdio.h>
+#include <math.h>
+#include <ctype.h>
+int main()
+{
+ double principalAmount, rateOfInterest, timePeriod, simpleInterest, compoundInterest;
+ char mode;
+ printf("Enter the principle amount, Rate of interest, Time : ");
+ scanf("%lf %lf %lf", &principalAmount, &rateOfInterest, &timePeriod);
+ printf("\nEnter the mode ('s' : simple interest, 'c' : compound interest) : ");
+ scanf(" %c", &mode);
+ mode = tolower(mode);
+ switch (mode)
+ {
+ case 's':
+ simpleInterest = (principalAmount * rateOfInterest * timePeriod) / 100;
+ printf("\nSimple Interest : %g", simpleInterest);
+ break;
+ case 'c':
+ compoundInterest = principalAmount * (pow((1 + rateOfInterest / 100), timePeriod) - 1);
+ printf("\nCompound Interest : %g", compoundInterest);
+ break;
+ default:
+ printf("\nInvalid Input");
+ return 1;
+ }
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P027.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P027.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P027.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P027_c', 'P027.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P027_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P027.c">
+ <pre><code class="language-c">/* 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 ('L' : laptop, 'D' : 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 <stdio.h>
+#include <ctype.h>
+int main()
+{
+ double principal_amount, desktop_discount, laptop_discount, discount_amount, discounted_price;
+ char choice;
+ printf("Enter the purchase amount : ");
+ scanf("%lf", &principal_amount);
+ printf("Type of purchase ('L' : Laptop, 'D' : Desktop) : ");
+ scanf(" %c", &choice);
+ choice = toupper(choice);
+ if (principal_amount <= 20000)
+ {
+ laptop_discount = 0.03;
+ desktop_discount = 0.05;
+ }
+ else if (principal_amount > 20000 && principal_amount <= 50000)
+ {
+ laptop_discount = 0.05;
+ desktop_discount = 0.075;
+ }
+ else if (principal_amount > 50000 && principal_amount <= 75000)
+ {
+ laptop_discount = 0.075;
+ desktop_discount = 0.105;
+ }
+ else if (principal_amount > 75000)
+ {
+ laptop_discount = 0.1;
+ desktop_discount = 0.15;
+ }
+ switch (choice)
+ {
+ case 'L':
+ discount_amount = principal_amount * laptop_discount;
+ discounted_price = principal_amount - discount_amount;
+ printf("\nDiscount Amount : %g"
+ "\nDiscounted Price : %g",
+ discount_amount, discounted_price);
+ break;
+ case 'D':
+ discount_amount = principal_amount * desktop_discount;
+ discounted_price = principal_amount - discount_amount;
+ printf("\nDiscount Amount : %g"
+ "\nDiscounted Price : %g",
+ discount_amount, discounted_price);
+ break;
+ default:
+ printf("\nInvalid Input.");
+ return 1;
+ }
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P028.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P028.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P028.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P028_c', 'P028.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P028_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P028.c">
+ <pre><code class="language-c">/* WAP to calculate factorial of a number */
+/* Author - Amit Dutta, Date - 11th OCT, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int i = 1, num, fact = 1;
+ printf("Enter the number : ");
+ if (scanf("%d", &num) != 1)
+ {
+ printf("\nPlease enter a number.");
+ return 1;
+ }
+ if (num == 0)
+ {
+ printf("\nFactorial of 0 : 1");
+ return 0;
+ }
+ if (num < 0)
+ {
+ printf("\nFactorial of %d : UNDEFINED", num);
+ return 0;
+ }
+ while (i <= num)
+ {
+ fact = fact * i;
+ i++;
+ }
+ printf("Factorial of %d : %d", num, fact);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P029.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P029.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P029.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P029_c', 'P029.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P029_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P029.c">
+ <pre><code class="language-c">/* WAP to perform addition of first n natural numbers. sum = 1 + 2 + 3 + ... */
+/* Author - Amit Dutta, Date - 11th OCT, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int num, i = 0, result = 0;
+ printf("Enter the value for n : ");
+ if (scanf("%d", &num) != 1)
+ {
+ printf("\nPlease enter a number.");
+ return 1;
+ }
+ if (num < 1)
+ {
+ printf("\nPlease enter a positive number.");
+ return 1;
+ }
+ while (i <= num)
+ {
+ result = result + i;
+ i++;
+ }
+ printf("\nResult : %d", result);
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P030.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P030.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P030.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P030_c', 'P030.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P030_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P030.c">
+ <pre><code class="language-c">/* Display the first 15 terms of the series. */
+/* Author - Amit Dutta, Date - 11th OCT, 2025 */
+
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+ int i, r;
+
+ // 3, 6, 9, 12, ...
+ {
+ i = 3, r = 0;
+ printf("Series 1 (3, 6, 9, 12, ...) :");
+ while (i <= 15)
+ {
+ r = r + 3;
+ printf(" %d", r);
+ i++;
+ }
+ }
+
+ // 1, 4, 9, 16, ...
+ {
+ i = 1;
+ printf("\nSeries 2 (1, 4, 9, 16, ...) :");
+ while (i <= 15)
+ {
+ printf(" %d", i * i);
+ i++;
+ }
+ }
+
+ // 4, 8, 16, 32, ...
+ {
+ i = 1, r = 2;
+ printf("\nSeries 3 (4, 8, 16, 32, ...) :");
+ while (i <= 15)
+ {
+ r = r * 2;
+ printf(" %d", r);
+ i++;
+ }
+ }
+
+ // 0, 7, 26, ...
+ {
+ i = 1, r;
+ printf("\nSeries 4 (0, 7, 26, ...) :");
+ while (i <= 15)
+ {
+ r = (int)pow(i, 3) - 1;
+ printf(" %d", r);
+ i++;
+ }
+ }
+
+ return 0;
+}
+</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P031.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P031.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P031.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P031_c', 'P031.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P031_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P031.c">
+ <pre><code class="language-c">/* Find the sum of the series */
+/* Author - Amit Dutta, Date - 11th OCT, 2025 */
+
+#include <stdio.h>
+#include <math.h>
+
+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("--- s = (a ^ 2) + (a ^ 2 / 2) + (a ^ 2 / 3) + ... + (a ^ 2 / 10) ---");
+ printf("\nEnter the number : ");
+ scanf("%lf", &a);
+ while (i <= 10)
+ {
+ res = res + ((a * a) / i);
+ i++;
+ }
+ printf("S = %g", res);
+ }
+
+ // s = 1 + (2 ^ 2 / a) + (3 ^ 3 / a ^ 2) + ... + n
+ {
+ res = 0, i = 0;
+ printf("\n--- // s = 1 + (2 ^ 2 / a) + (3 ^ 3 / a ^ 2) + ... + n ---");
+ printf("\nEnter the value for a and n : ");
+ scanf(" %lf %lf", &a, &n);
+ while (i <= n - 1)
+ {
+ res = res + (pow(i + 1, i + 1) / pow(a, i));
+ i++;
+ }
+ printf("S = %g", res);
+ }
+
+ return 0;
+}</code></pre>
+ </div>
</li>
<li>
- <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P032.c" target="_blank" class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">P032.c</span>
- <span class="ml-auto text-green-500 text-sm">View Code →</span>
- </a>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P032.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-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-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 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.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-tuition-c-P032_c', 'P032.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P032_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P032.c">
+ <pre><code class="language-c">/* 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 <stdio.h>
+int main()
+{
+ int n, temp, sod = 0;
+ printf("Enter the number : ");
+ scanf("%d", &n);
+ temp = n;
+ while (temp > 0)
+ {
+ sod = sod + (temp % 10);
+ temp = temp / 10;
+ }
+ if (n % sod == 0)
+ printf("\nIt is Niven number.");
+ else
+ printf("\nIt is not a Niven number.");
+ return 0;
+}</code></pre>
+ </div>
</li>
</ul>
</div>
</li>
- </ul>
- </div>
- </div>
- <footer class="text-center py-4 bg-gray-100 border-t">
- <p class="text-sm text-gray-500">This page is an index for the <a href="https://github.com/notamitgamer/bsc" class="text-blue-600 hover:underline">bsc repository</a>.</p>
- </footer>
+ </ul>
+ </div>
</div>
+ <footer class="text-center py-4 bg-gray-50 border-t">
+ <p class="text-sm text-gray-500">
+ This page is an index for the
+ <a
+ href="https://github.com/notamitgamer/bsc"
+ class="text-blue-600 hover:underline"
+ >bsc repository</a
+ >.
+ </p>
+ </footer>
+ </div>
</div>
-
+
+ <!-- Code Viewer Modal -->
+ <div
+ id="code-modal"
+ class="fixed inset-0 bg-gray-900 bg-opacity-80 flex items-center justify-center p-4 hidden z-50"
+ >
+ <div
+ class="bg-gray-800 text-gray-100 rounded-lg shadow-2xl w-full max-w-5xl max-h-full flex flex-col"
+ >
+ <!-- Modal Header -->
+ <div
+ class="flex items-center justify-between p-4 border-b border-gray-700 bg-gray-900 rounded-t-lg"
+ >
+ <h3 id="modal-filename" class="text-lg font-mono text-gray-300"></h3>
+ <div class="flex items-center space-x-3">
+ <button
+ id="share-btn"
+ class="bg-gray-700 text-gray-200 p-2 rounded-md hover:bg-gray-600 relative transition-colors"
+ title="Share file link (Copies GitHub URL if sharing is unavailable)"
+ >
+ <!-- Default Share Icon -->
+ <svg
+ class="w-5 h-5"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ id="share-icon-default"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8m-4-6l-4-4-4 4m4-4v13"
+ ></path>
+ </svg>
+ <!-- Success Checkmark Icon (Hidden by Default) -->
+ <svg
+ class="w-5 h-5 absolute inset-0 m-auto hidden text-green-400"
+ id="share-icon-success"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M5 13l4 4L19 7"
+ ></path>
+ </svg>
+ </button>
+ <button
+ id="copy-code-btn"
+ class="bg-gray-700 text-gray-200 p-2 rounded-md hover:bg-gray-600 relative transition-colors"
+ title="Copy code to clipboard"
+ >
+ <!-- Default Copy Icon -->
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="16"
+ height="16"
+ fill="currentColor"
+ class="bi bi-copy w-5 h-5"
+ viewBox="0 0 16 16"
+ id="copy-icon-default"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z"
+ />
+ </svg>
+ <!-- Success Checkmark Icon (Hidden by Default) -->
+ <svg
+ class="w-5 h-5 absolute inset-0 m-auto hidden text-green-400"
+ id="copy-icon-success"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M5 13l4 4L19 7"
+ ></path>
+ </svg>
+ </button>
+ <button
+ onclick="hideCode()"
+ class="text-gray-400 hover:text-white text-3xl leading-none"
+ >
+ ×
+ </button>
+ </div>
+ </div>
+ <!-- Modal Body -->
+ <div id="modal-body" class="p-1 overflow-y-auto">
+ <div id="modal-code-container" class="rounded-b-lg">
+ <!-- Code will be injected here -->
+ </div>
+ </div>
+ </div>
+ </div>
+
<script>
- function toggleFolder(folderName) {
- const content = document.getElementById(`folder-${folderName}`);
- const chevron = document.getElementById(`chevron-${folderName}`);
-
- if (content.classList.contains('hidden')) {
- content.classList.remove('hidden');
- chevron.classList.add('rotated');
- } else {
- content.classList.add('hidden');
- chevron.classList.remove('rotated');
+ function toggleFolder(folderName) {
+ const content = document.getElementById(`folder-${folderName}`);
+ const chevron = document.getElementById(`chevron-${folderName}`);
+
+ if (content.classList.contains("hidden")) {
+ content.classList.remove("hidden");
+ chevron.classList.add("rotated");
+ } else {
+ content.classList.add("hidden");
+ chevron.classList.remove("rotated");
+ }
+ }
+
+ const modal = document.getElementById("code-modal");
+ const modalFilename = document.getElementById("modal-filename");
+ const modalCodeContainer = document.getElementById(
+ "modal-code-container"
+ );
+
+ const copyBtn = document.getElementById("copy-code-btn");
+ const copyIconDefault = document.getElementById("copy-icon-default");
+ const copyIconSuccess = document.getElementById("copy-icon-success");
+
+ const shareBtn = document.getElementById("share-btn");
+ const shareIconDefault = document.getElementById("share-icon-default");
+ const shareIconSuccess = document.getElementById("share-icon-success");
+
+ let currentFileUrl = "";
+
+ /**
+ * Shows a successful copy animation on a button.
+ * @param {HTMLElement} button - The button element.
+ * @param {HTMLElement} defaultIcon - The default icon element.
+ * @param {HTMLElement} successIcon - The success icon element.
+ */
+ function animateSuccess(button, defaultIcon, successIcon) {
+ // 1. Swap icons
+ defaultIcon.classList.add("hidden");
+ successIcon.classList.remove("hidden");
+
+ // 2. Apply success visual cue (green background pulse)
+ button.classList.add("btn-success-pulse");
+ button.classList.remove("bg-gray-700", "hover:bg-gray-600");
+
+ // 3. Revert after 2 seconds
+ setTimeout(() => {
+ successIcon.classList.add("hidden");
+ defaultIcon.classList.remove("hidden");
+ button.classList.remove("btn-success-pulse");
+ button.classList.add("bg-gray-700", "hover:bg-gray-600");
+ }, 2000);
+ }
+
+ function showCode(codeBlockId, filename) {
+ const codeBlock = document.getElementById(codeBlockId);
+ if (codeBlock) {
+ modalFilename.textContent = filename;
+ modalCodeContainer.innerHTML = codeBlock.innerHTML;
+
+ currentFileUrl = codeBlock.dataset.githubUrl || "";
+
+ hljs.highlightElement(modalCodeContainer.querySelector("code"));
+
+ modal.classList.remove("hidden");
+ document.body.style.overflow = "hidden";
+ }
+ }
+
+ function hideCode() {
+ modal.classList.add("hidden");
+ document.body.style.overflow = "auto";
+ }
+
+ copyBtn.addEventListener("click", () => {
+ const codeToCopy = modalCodeContainer.querySelector("code").innerText;
+ navigator.clipboard.writeText(codeToCopy).then(
+ () => {
+ // Use the reusable animation function for code copy
+ animateSuccess(copyBtn, copyIconDefault, copyIconSuccess);
+ },
+ (err) => {
+ console.error("Failed to copy text: ", err);
+ // Replace old alert with a console error or a custom message box if needed
+ }
+ );
+ });
+
+ shareBtn.addEventListener("click", async () => {
+ // Ensure currentFileUrl is set (it's the GitHub link)
+ if (!currentFileUrl) return;
+
+ const shareData = {
+ title: modalFilename.textContent,
+ text: `Check out the code for ${modalFilename.textContent}`,
+ url: currentFileUrl,
+ };
+
+ // 1. Try to use Web Share API
+ if (navigator.share) {
+ try {
+ await navigator.share(shareData);
+ // If sharing is successful, no need for clipboard animation
+ } catch (err) {
+ // User likely cancelled the share dialog, no action needed
+ if (err.name !== 'AbortError') {
+ console.error("Share failed:", err.message);
}
+ }
+ } else {
+ // 2. Fallback: Copy URL to clipboard
+ navigator.clipboard.writeText(currentFileUrl).then(() => {
+ // Trigger animation to show link was copied
+ animateSuccess(shareBtn, shareIconDefault, shareIconSuccess);
+ });
+ }
+ });
+
+ document.addEventListener("keydown", (e) => {
+ if (e.key === "Escape" && !modal.classList.contains("hidden")) {
+ hideCode();
}
+ });
</script>
-</body>
+ </body>
</html>
diff --git a/docs/template.html b/docs/template.html
@@ -1,54 +1,314 @@
<!DOCTYPE html>
<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BSc Repository File Index</title>
<script src="https://cdn.tailwindcss.com"></script>
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
+ <link
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
+ rel="stylesheet"
+ />
+ <link
+ rel="stylesheet"
+ href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css"
+ />
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
+
<style>
- body {
- font-family: 'Inter', sans-serif;
+ body {
+ font-family: "Inter", sans-serif;
+ }
+ .chevron.rotated {
+ transform: rotate(180deg);
+ }
+ #modal-body pre {
+ max-height: 70vh;
+ }
+ /* Animation for success feedback */
+ .btn-success-pulse {
+ background-color: #10b981 !important; /* Tailwind green-500 */
+ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); /* green-500 with opacity */
+ animation: pulse-success 0.5s ease-out;
+ }
+ @keyframes pulse-success {
+ 0% {
+ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
}
- .chevron.rotated {
- transform: rotate(180deg);
+ 50% {
+ box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
}
+ 100% {
+ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
+ }
+ }
</style>
-</head>
-<body class="bg-gray-50">
+ </head>
+ <body class="bg-gray-100">
<div class="container mx-auto px-4 py-8 md:py-16">
- <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-lg overflow-hidden">
- <div class="p-8">
- <div class="text-center mb-8">
- <h1 class="text-3xl md:text-4xl font-bold text-gray-800">BSc Repository Contents</h1>
- <p class="text-gray-500 mt-2">A quick navigation guide to the files in the repository.</p>
- </div>
- <div class="space-y-4">
- <h2 class="text-lg font-semibold text-gray-700 border-b pb-2">Files and Folders</h2>
- <ul class="space-y-3">
- <!--FILE_LIST_PLACEHOLDER-->
- </ul>
- </div>
- </div>
- <footer class="text-center py-4 bg-gray-100 border-t">
- <p class="text-sm text-gray-500">This page is an index for the <a href="https://github.com/notamitgamer/bsc" class="text-blue-600 hover:underline">bsc repository</a>.</p>
- </footer>
+ <div
+ class="max-w-4xl mx-auto bg-white rounded-2xl shadow-lg overflow-hidden"
+ >
+ <div class="p-8">
+ <div class="text-center mb-8">
+ <h1 class="text-3xl md:text-4xl font-bold text-gray-800">
+ BSc Repository Contents
+ </h1>
+ <p class="text-gray-500 mt-2">
+ A quick navigation guide to the files in the repository.
+ </p>
+ </div>
+ <div class="space-y-4">
+ <h2 class="text-lg font-semibold text-gray-700 border-b pb-2">
+ Files and Folders
+ </h2>
+ <ul class="space-y-3">
+ <!--FILE_LIST_PLACEHOLDER-->
+ </ul>
+ </div>
+ </div>
+ <footer class="text-center py-4 bg-gray-50 border-t">
+ <p class="text-sm text-gray-500">
+ This page is an index for the
+ <a
+ href="https://github.com/notamitgamer/bsc"
+ class="text-blue-600 hover:underline"
+ >bsc repository</a
+ >.
+ </p>
+ </footer>
+ </div>
+ </div>
+
+ <!-- Code Viewer Modal -->
+ <div
+ id="code-modal"
+ class="fixed inset-0 bg-gray-900 bg-opacity-80 flex items-center justify-center p-4 hidden z-50"
+ >
+ <div
+ class="bg-gray-800 text-gray-100 rounded-lg shadow-2xl w-full max-w-5xl max-h-full flex flex-col"
+ >
+ <!-- Modal Header -->
+ <div
+ class="flex items-center justify-between p-4 border-b border-gray-700 bg-gray-900 rounded-t-lg"
+ >
+ <h3 id="modal-filename" class="text-lg font-mono text-gray-300"></h3>
+ <div class="flex items-center space-x-3">
+ <button
+ id="share-btn"
+ class="bg-gray-700 text-gray-200 p-2 rounded-md hover:bg-gray-600 relative transition-colors"
+ title="Share file link (Copies GitHub URL if sharing is unavailable)"
+ >
+ <!-- Default Share Icon -->
+ <svg
+ class="w-5 h-5"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ id="share-icon-default"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8m-4-6l-4-4-4 4m4-4v13"
+ ></path>
+ </svg>
+ <!-- Success Checkmark Icon (Hidden by Default) -->
+ <svg
+ class="w-5 h-5 absolute inset-0 m-auto hidden text-green-400"
+ id="share-icon-success"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M5 13l4 4L19 7"
+ ></path>
+ </svg>
+ </button>
+ <button
+ id="copy-code-btn"
+ class="bg-gray-700 text-gray-200 p-2 rounded-md hover:bg-gray-600 relative transition-colors"
+ title="Copy code to clipboard"
+ >
+ <!-- Default Copy Icon -->
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="16"
+ height="16"
+ fill="currentColor"
+ class="bi bi-copy w-5 h-5"
+ viewBox="0 0 16 16"
+ id="copy-icon-default"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z"
+ />
+ </svg>
+ <!-- Success Checkmark Icon (Hidden by Default) -->
+ <svg
+ class="w-5 h-5 absolute inset-0 m-auto hidden text-green-400"
+ id="copy-icon-success"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M5 13l4 4L19 7"
+ ></path>
+ </svg>
+ </button>
+ <button
+ onclick="hideCode()"
+ class="text-gray-400 hover:text-white text-3xl leading-none"
+ >
+ ×
+ </button>
+ </div>
+ </div>
+ <!-- Modal Body -->
+ <div id="modal-body" class="p-1 overflow-y-auto">
+ <div id="modal-code-container" class="rounded-b-lg">
+ <!-- Code will be injected here -->
+ </div>
</div>
+ </div>
</div>
-
+
<script>
- function toggleFolder(folderName) {
- const content = document.getElementById(`folder-${folderName}`);
- const chevron = document.getElementById(`chevron-${folderName}`);
-
- if (content.classList.contains('hidden')) {
- content.classList.remove('hidden');
- chevron.classList.add('rotated');
- } else {
- content.classList.add('hidden');
- chevron.classList.remove('rotated');
+ function toggleFolder(folderName) {
+ const content = document.getElementById(`folder-${folderName}`);
+ const chevron = document.getElementById(`chevron-${folderName}`);
+
+ if (content.classList.contains("hidden")) {
+ content.classList.remove("hidden");
+ chevron.classList.add("rotated");
+ } else {
+ content.classList.add("hidden");
+ chevron.classList.remove("rotated");
+ }
+ }
+
+ const modal = document.getElementById("code-modal");
+ const modalFilename = document.getElementById("modal-filename");
+ const modalCodeContainer = document.getElementById(
+ "modal-code-container"
+ );
+
+ const copyBtn = document.getElementById("copy-code-btn");
+ const copyIconDefault = document.getElementById("copy-icon-default");
+ const copyIconSuccess = document.getElementById("copy-icon-success");
+
+ const shareBtn = document.getElementById("share-btn");
+ const shareIconDefault = document.getElementById("share-icon-default");
+ const shareIconSuccess = document.getElementById("share-icon-success");
+
+ let currentFileUrl = "";
+
+ /**
+ * Shows a successful copy animation on a button.
+ * @param {HTMLElement} button - The button element.
+ * @param {HTMLElement} defaultIcon - The default icon element.
+ * @param {HTMLElement} successIcon - The success icon element.
+ */
+ function animateSuccess(button, defaultIcon, successIcon) {
+ // 1. Swap icons
+ defaultIcon.classList.add("hidden");
+ successIcon.classList.remove("hidden");
+
+ // 2. Apply success visual cue (green background pulse)
+ button.classList.add("btn-success-pulse");
+ button.classList.remove("bg-gray-700", "hover:bg-gray-600");
+
+ // 3. Revert after 2 seconds
+ setTimeout(() => {
+ successIcon.classList.add("hidden");
+ defaultIcon.classList.remove("hidden");
+ button.classList.remove("btn-success-pulse");
+ button.classList.add("bg-gray-700", "hover:bg-gray-600");
+ }, 2000);
+ }
+
+ function showCode(codeBlockId, filename) {
+ const codeBlock = document.getElementById(codeBlockId);
+ if (codeBlock) {
+ modalFilename.textContent = filename;
+ modalCodeContainer.innerHTML = codeBlock.innerHTML;
+
+ currentFileUrl = codeBlock.dataset.githubUrl || "";
+
+ hljs.highlightElement(modalCodeContainer.querySelector("code"));
+
+ modal.classList.remove("hidden");
+ document.body.style.overflow = "hidden";
+ }
+ }
+
+ function hideCode() {
+ modal.classList.add("hidden");
+ document.body.style.overflow = "auto";
+ }
+
+ copyBtn.addEventListener("click", () => {
+ const codeToCopy = modalCodeContainer.querySelector("code").innerText;
+ navigator.clipboard.writeText(codeToCopy).then(
+ () => {
+ // Use the reusable animation function for code copy
+ animateSuccess(copyBtn, copyIconDefault, copyIconSuccess);
+ },
+ (err) => {
+ console.error("Failed to copy text: ", err);
+ // Replace old alert with a console error or a custom message box if needed
+ }
+ );
+ });
+
+ shareBtn.addEventListener("click", async () => {
+ // Ensure currentFileUrl is set (it's the GitHub link)
+ if (!currentFileUrl) return;
+
+ const shareData = {
+ title: modalFilename.textContent,
+ text: `Check out the code for ${modalFilename.textContent}`,
+ url: currentFileUrl,
+ };
+
+ // 1. Try to use Web Share API
+ if (navigator.share) {
+ try {
+ await navigator.share(shareData);
+ // If sharing is successful, no need for clipboard animation
+ } catch (err) {
+ // User likely cancelled the share dialog, no action needed
+ if (err.name !== 'AbortError') {
+ console.error("Share failed:", err.message);
}
+ }
+ } else {
+ // 2. Fallback: Copy URL to clipboard
+ navigator.clipboard.writeText(currentFileUrl).then(() => {
+ // Trigger animation to show link was copied
+ animateSuccess(shareBtn, shareIconDefault, shareIconSuccess);
+ });
+ }
+ });
+
+ document.addEventListener("keydown", (e) => {
+ if (e.key === "Escape" && !modal.classList.contains("hidden")) {
+ hideCode();
}
+ });
</script>
-</body>
+ </body>
</html>