commit f099815c6c117df47b74a7fbe4ce10a423018bf4
parent 690dc591def962c6353f37eeb6c1d5835b4edfdb
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Fri, 21 Nov 2025 20:34:59 +0530
new -21112025 .\tuition-c\APC-PRAC-037, 038, 039, 040, 041
Diffstat:
6 files changed, 459 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">(112 files)</span>
+ <span class="ml-2 text-sm text-gray-500">(117 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">
@@ -6337,6 +6337,270 @@ int 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-PRAC-037.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-037.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-037_c', 'APC-PRAC-037.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-037_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-037.c">
+ <pre><code class="language-c">/* Show all the armstrong number between a range. */
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+#include <math.h>
+
+#define lowerBound 100
+#define upperBound 999
+
+int isArmstrongNumber(int);
+
+int isArmstrongNumber(int n)
+{
+ int temp = n, sum = 0, count = 0;
+ while (temp > 0)
+ {
+ count++;
+ temp /= 10;
+ }
+ temp = n;
+ while (temp > 0)
+ {
+ sum += (int)pow(temp % 10, count);
+ temp /= 10;
+ }
+ return sum == n;
+}
+
+int main()
+{
+ int n, i, count = 0;
+ printf("Armstrong number between %d and %d are: ", lowerBound, upperBound);
+ for (i = lowerBound; i <= upperBound; i++)
+ if (isArmstrongNumber(i))
+ {
+ printf("%d ", i);
+ count++;
+ }
+ printf("\n\nCount: %d\n", count);
+ 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-PRAC-038.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-038.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-038_c', 'APC-PRAC-038.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-038_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-038.c">
+ <pre><code class="language-c">/*
+Print all combinations of two two-digit numbers such that the sum of digits of both numbers is equal.
+Example: 23 and 41 → (2+3) = 5, (4+1) = 5.
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+
+int main()
+{
+ printf("Combinations of two two-digit numbers such that the sum of digits of both numbers is equal: ");
+ int i, j, sum1, sum2, count = 0;
+ for (i = 10; i <= 99; i++)
+ {
+ sum1 = (i % 10) + (i / 10);
+ for (j = i + 1; j <= 99; j++)
+ {
+ sum2 = (j % 10) + (j / 10);
+ if (sum1 == sum2)
+ {
+ printf("(%d, %d) ", i, j);
+ count++;
+ }
+ }
+ }
+ printf("\nCount: %d\n", count);
+ 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-PRAC-039.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-039.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-039_c', 'APC-PRAC-039.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-039_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-039.c">
+ <pre><code class="language-c">/*
+Write a C program to print all unique combinations of three numbers (a, b, c) such that:
+1 ≤ a, b, c ≤ 30 and a² + b² = c² (Pythagorean triplets)
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+
+int main()
+{
+ printf("a² + b² = c² : ");
+ int i, j, k, sq1, sq2, count = 0;
+ for (i = 1; i <= 30; i++)
+ {
+ sq1 = i * i;
+ for (j = i + 1; j <= 30; j++)
+ {
+ sq2 = j * j;
+ for (k = j + 1; k <= 30; k++)
+ {
+ if (sq1 + sq2 == k * k)
+ {
+ printf("(%d, %d, %d) ", i, j, k);
+ count++;
+ }
+ }
+ }
+ }
+ printf("\n\nCount: %d\n", count);
+ 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-PRAC-040.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-040.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-040_c', 'APC-PRAC-040.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-040_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-040.c">
+ <pre><code class="language-c">/*
+Write a C program to count how many numbers between 100 and 999 have all distinct digits (e.g., 123, 709, 981).
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+
+int main()
+{
+ int i, count = 0, n1, n2, n3;
+ printf("Distinct numbers between 100 and 999: ");
+ for (i = 100; i <= 999; i++)
+ {
+ n1 = i / 100;
+ n2 = (i % 100) / 10;
+ n3 = i % 10;
+ if (n1 != n2 && n2 != n3 && n1 != n3)
+ {
+ printf("%d ", i);
+ count++;
+ }
+ }
+ printf("\nCount: %d\n", count);
+ 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-PRAC-041.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-041.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-041_c', 'APC-PRAC-041.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-APC-PRAC-041_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-041.c">
+ <pre><code class="language-c">/*
+Write a C program to find and print all twin prime pairs between 1 and n using nested loops.
+(Twin primes are prime numbers having a difference of 2, like 11 and 13)
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+#include <math.h>
+
+int isPrime(int n)
+{
+ if (n < 2)
+ return 0;
+ if (n == 2)
+ return 1;
+ if (n % 2 == 0)
+ return 0;
+ int i, temp = (int)sqrt(n);
+ for (i = 3; i <= temp; i += 2)
+ if (n % i == 0)
+ return 0;
+ return 1;
+}
+
+int main()
+{
+ int n, i, count = 0;
+ printf("enter the n: ");
+ scanf("%d", &n);
+ printf("\nAll the twin numbers: ");
+ for (i = 1; i <= n - 2; i++)
+ {
+ if (isPrime(i))
+ {
+ if (isPrime(i + 2))
+ {
+ printf("(%d, %d) ", i, i + 2);
+ count++;
+ }
+ }
+ }
+ printf("\nCount; %d", count);
+ 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-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-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">
diff --git a/tuition-c/APC-PRAC-037.c b/tuition-c/APC-PRAC-037.c
@@ -0,0 +1,45 @@
+/* Show all the armstrong number between a range. */
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+#include <math.h>
+
+#define lowerBound 100
+#define upperBound 999
+
+int isArmstrongNumber(int);
+
+int isArmstrongNumber(int n)
+{
+ int temp = n, sum = 0, count = 0;
+ while (temp > 0)
+ {
+ count++;
+ temp /= 10;
+ }
+ temp = n;
+ while (temp > 0)
+ {
+ sum += (int)pow(temp % 10, count);
+ temp /= 10;
+ }
+ return sum == n;
+}
+
+int main()
+{
+ int n, i, count = 0;
+ printf("Armstrong number between %d and %d are: ", lowerBound, upperBound);
+ for (i = lowerBound; i <= upperBound; i++)
+ if (isArmstrongNumber(i))
+ {
+ printf("%d ", i);
+ count++;
+ }
+ printf("\n\nCount: %d\n", count);
+ return 0;
+}+
\ No newline at end of file
diff --git a/tuition-c/APC-PRAC-038.c b/tuition-c/APC-PRAC-038.c
@@ -0,0 +1,32 @@
+/*
+Print all combinations of two two-digit numbers such that the sum of digits of both numbers is equal.
+Example: 23 and 41 → (2+3) = 5, (4+1) = 5.
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+
+int main()
+{
+ printf("Combinations of two two-digit numbers such that the sum of digits of both numbers is equal: ");
+ int i, j, sum1, sum2, count = 0;
+ for (i = 10; i <= 99; i++)
+ {
+ sum1 = (i % 10) + (i / 10);
+ for (j = i + 1; j <= 99; j++)
+ {
+ sum2 = (j % 10) + (j / 10);
+ if (sum1 == sum2)
+ {
+ printf("(%d, %d) ", i, j);
+ count++;
+ }
+ }
+ }
+ printf("\nCount: %d\n", count);
+ return 0;
+}+
\ No newline at end of file
diff --git a/tuition-c/APC-PRAC-039.c b/tuition-c/APC-PRAC-039.c
@@ -0,0 +1,35 @@
+/*
+Write a C program to print all unique combinations of three numbers (a, b, c) such that:
+1 ≤ a, b, c ≤ 30 and a² + b² = c² (Pythagorean triplets)
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+
+int main()
+{
+ printf("a² + b² = c² : ");
+ int i, j, k, sq1, sq2, count = 0;
+ for (i = 1; i <= 30; i++)
+ {
+ sq1 = i * i;
+ for (j = i + 1; j <= 30; j++)
+ {
+ sq2 = j * j;
+ for (k = j + 1; k <= 30; k++)
+ {
+ if (sq1 + sq2 == k * k)
+ {
+ printf("(%d, %d, %d) ", i, j, k);
+ count++;
+ }
+ }
+ }
+ }
+ printf("\n\nCount: %d\n", count);
+ return 0;
+}+
\ No newline at end of file
diff --git a/tuition-c/APC-PRAC-040.c b/tuition-c/APC-PRAC-040.c
@@ -0,0 +1,29 @@
+/*
+Write a C program to count how many numbers between 100 and 999 have all distinct digits (e.g., 123, 709, 981).
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+
+int main()
+{
+ int i, count = 0, n1, n2, n3;
+ printf("Distinct numbers between 100 and 999: ");
+ for (i = 100; i <= 999; i++)
+ {
+ n1 = i / 100;
+ n2 = (i % 100) / 10;
+ n3 = i % 10;
+ if (n1 != n2 && n2 != n3 && n1 != n3)
+ {
+ printf("%d ", i);
+ count++;
+ }
+ }
+ printf("\nCount: %d\n", count);
+ return 0;
+}+
\ No newline at end of file
diff --git a/tuition-c/APC-PRAC-041.c b/tuition-c/APC-PRAC-041.c
@@ -0,0 +1,48 @@
+/*
+Write a C program to find and print all twin prime pairs between 1 and n using nested loops.
+(Twin primes are prime numbers having a difference of 2, like 11 and 13)
+*/
+/* Author: Amit Dutta, Date: 21-11-2025 */
+
+// This code has not been compiled.
+// If you find any issues, please create a new issue on GitHub regarding them.
+// Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
+
+#include <stdio.h>
+#include <math.h>
+
+int isPrime(int n)
+{
+ if (n < 2)
+ return 0;
+ if (n == 2)
+ return 1;
+ if (n % 2 == 0)
+ return 0;
+ int i, temp = (int)sqrt(n);
+ for (i = 3; i <= temp; i += 2)
+ if (n % i == 0)
+ return 0;
+ return 1;
+}
+
+int main()
+{
+ int n, i, count = 0;
+ printf("enter the n: ");
+ scanf("%d", &n);
+ printf("\nAll the twin numbers: ");
+ for (i = 1; i <= n - 2; i++)
+ {
+ if (isPrime(i))
+ {
+ if (isPrime(i + 2))
+ {
+ printf("(%d, %d) ", i, i + 2);
+ count++;
+ }
+ }
+ }
+ printf("\nCount; %d", count);
+ return 0;
+}+
\ No newline at end of file