commit 4a4a3aa52a0b158264af1ef7cabdb81e233ba46f
parent 6e3d36f1298b6ac2861f63f02e19fe2ee312461f
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Tue, 18 Nov 2025 19:14:12 +0530
new -18112025 _tuition-c/APC-S-008,009,010
Diffstat:
4 files changed, 363 insertions(+), 1 deletion(-)
diff --git a/docs/index.html b/docs/index.html
@@ -4775,7 +4775,7 @@ int main()
<div class="flex items-center">
<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>
<span class="font-medium text-gray-800">tuition-c</span>
- <span class="ml-2 text-sm text-gray-500">(103 files)</span>
+ <span class="ml-2 text-sm text-gray-500">(106 files)</span>
</div>
<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">
@@ -6380,6 +6380,208 @@ void main()
<li>
<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-008.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-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-S-008_c', 'APC-S-008.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-S-008_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-008.c">
+ <pre><code class="language-c">/* Write a program to print the sum of two matrix as input given by the user. */
+/* Author: Amit Dutta, Date: 18-11-2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int rows, cols, i, j;
+ printf("Enter the number of rows and columns: ");
+ scanf("%d %d", &rows, &cols);
+
+ int a[rows][cols], b[rows][cols], c[rows][cols];
+
+ printf("Enter the elements of matrix A (%d x %d): \n", rows, cols);
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ {
+ printf("Position %d%d: ", i, j);
+ scanf("%d", &a[i][j]);
+ }
+ printf("\nMatrix A: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", a[i][j]);
+ printf("\n");
+ }
+
+ printf("\nEnter the elements of matrix B(%d x %d): \n", rows, cols);
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ {
+ printf("Position %d%d: ", i, j);
+ scanf("%d", &b[i][j]);
+ }
+ printf("\nMatrix B: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", b[i][j]);
+ printf("\n");
+ }
+
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ c[i][j] = a[i][j] + b[i][j];
+
+ printf("\nResult Matrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", c[i][j]);
+ printf("\n");
+ }
+
+ return 0;
+}</code></pre>
+ </div>
+ </li>
+
+ <li>
+ <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-009.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-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-S-009_c', 'APC-S-009.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-S-009_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-009.c">
+ <pre><code class="language-c">/* Write a program to find the upper and lower triangular matrix. */
+/* Author: Amit Dutta, Date: 18-11-2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int i, j, rows, cols;
+ printf("\nEnter the number of rows and columns : ");
+ scanf("%d %d", &rows, &cols);
+
+ if (rows != cols)
+ {
+ printf("Triangular matrix definitions only apply to square matrices (rows == columns).\n");
+ return 1;
+ }
+
+ int matrix[rows][cols];
+
+ printf("Enter the elements of matrix (%d x %d): \n", rows, cols);
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ {
+ printf("Position %d%d: ", i, j);
+ scanf("%d", &matrix[i][j]);
+ }
+ printf("\nMatrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", matrix[i][j]);
+ printf("\n");
+ }
+
+ printf("\nUpper triangular of the Matrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ {
+ if (j >= i)
+ printf("%d ", matrix[i][j]);
+ else
+ printf("~ ");
+ }
+ printf("\n");
+ }
+
+ printf("\nLower triangular of the Matrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ {
+ if (j <= i)
+ printf("%d ", matrix[i][j]);
+ else
+ printf("~ ");
+ }
+ printf("\n");
+ }
+
+ return 0;
+}</code></pre>
+ </div>
+ </li>
+
+ <li>
+ <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-010.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-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-S-010_c', 'APC-S-010.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-S-010_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-010.c">
+ <pre><code class="language-c">/* Write a program to input a new element at a specific position of an array.
+ a[] = {4, 5, 2, 10, 6, 9, 8}, newItem = 7, position = 3
+*/
+/* Author: Amit Dutta, Date: 18-11-2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int a[8] = {4, 5, 2, 10, 6, 9, 8};
+ int i;
+
+ printf("Elemnts of the array: ");
+ for (i = 0; i <= 6; i++)
+ printf("%d ", a[i]);
+
+ printf("\nMethod 1: ");
+ for (i = 7; i >= 4; i--)
+ a[i] = a[i - 1];
+ a[3] = 7;
+ for (i = 0; i <= 7; i++)
+ printf("%d ", a[i]);
+
+ // another method
+ printf("\nMethod 2: ");
+ int b[8] = {4, 5, 2, 10, 6, 9, 8};
+ int temp1 = 7;
+ for (i = 3; i <= 7; i++)
+ {
+ int temp2 = b[i];
+ b[i] = temp1;
+ temp1 = temp2;
+ }
+ for (i = 0; i <= 7; i++)
+ printf("%d ", b[i]);
+
+ return 0;
+}</code></pre>
+ </div>
+ </li>
+
+ <li>
+ <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>
<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">
diff --git a/tuition-c/APC-S-008.c b/tuition-c/APC-S-008.c
@@ -0,0 +1,57 @@
+/* Write a program to print the sum of two matrix as input given by the user. */
+/* Author: Amit Dutta, Date: 18-11-2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int rows, cols, i, j;
+ printf("Enter the number of rows and columns: ");
+ scanf("%d %d", &rows, &cols);
+
+ int a[rows][cols], b[rows][cols], c[rows][cols];
+
+ printf("Enter the elements of matrix A (%d x %d): \n", rows, cols);
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ {
+ printf("Position %d%d: ", i, j);
+ scanf("%d", &a[i][j]);
+ }
+ printf("\nMatrix A: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", a[i][j]);
+ printf("\n");
+ }
+
+ printf("\nEnter the elements of matrix B(%d x %d): \n", rows, cols);
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ {
+ printf("Position %d%d: ", i, j);
+ scanf("%d", &b[i][j]);
+ }
+ printf("\nMatrix B: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", b[i][j]);
+ printf("\n");
+ }
+
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ c[i][j] = a[i][j] + b[i][j];
+
+ printf("\nResult Matrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", c[i][j]);
+ printf("\n");
+ }
+
+ return 0;
+}+
\ No newline at end of file
diff --git a/tuition-c/APC-S-009.c b/tuition-c/APC-S-009.c
@@ -0,0 +1,62 @@
+/* Write a program to find the upper and lower triangular matrix. */
+/* Author: Amit Dutta, Date: 18-11-2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int i, j, rows, cols;
+ printf("\nEnter the number of rows and columns : ");
+ scanf("%d %d", &rows, &cols);
+
+ if (rows != cols)
+ {
+ printf("Triangular matrix definitions only apply to square matrices (rows == columns).\n");
+ return 1;
+ }
+
+ int matrix[rows][cols];
+
+ printf("Enter the elements of matrix (%d x %d): \n", rows, cols);
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ {
+ printf("Position %d%d: ", i, j);
+ scanf("%d", &matrix[i][j]);
+ }
+ printf("\nMatrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ printf("%d ", matrix[i][j]);
+ printf("\n");
+ }
+
+ printf("\nUpper triangular of the Matrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ {
+ if (j >= i)
+ printf("%d ", matrix[i][j]);
+ else
+ printf("~ ");
+ }
+ printf("\n");
+ }
+
+ printf("\nLower triangular of the Matrix: \n");
+ for (i = 0; i < rows; i++)
+ {
+ for (j = 0; j < cols; j++)
+ {
+ if (j <= i)
+ printf("%d ", matrix[i][j]);
+ else
+ printf("~ ");
+ }
+ printf("\n");
+ }
+
+ return 0;
+}+
\ No newline at end of file
diff --git a/tuition-c/APC-S-010.c b/tuition-c/APC-S-010.c
@@ -0,0 +1,38 @@
+/* Write a program to input a new element at a specific position of an array.
+ a[] = {4, 5, 2, 10, 6, 9, 8}, newItem = 7, position = 3
+*/
+/* Author: Amit Dutta, Date: 18-11-2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int a[8] = {4, 5, 2, 10, 6, 9, 8};
+ int i;
+
+ printf("Elemnts of the array: ");
+ for (i = 0; i <= 6; i++)
+ printf("%d ", a[i]);
+
+ printf("\nMethod 1: ");
+ for (i = 7; i >= 4; i--)
+ a[i] = a[i - 1];
+ a[3] = 7;
+ for (i = 0; i <= 7; i++)
+ printf("%d ", a[i]);
+
+ // another method
+ printf("\nMethod 2: ");
+ int b[8] = {4, 5, 2, 10, 6, 9, 8};
+ int temp1 = 7;
+ for (i = 3; i <= 7; i++)
+ {
+ int temp2 = b[i];
+ b[i] = temp1;
+ temp1 = temp2;
+ }
+ for (i = 0; i <= 7; i++)
+ printf("%d ", b[i]);
+
+ return 0;
+}+
\ No newline at end of file