commit 753291ef65b982f8663b0efc31ad245379712d17
parent b693e554e75822fc0c46be6eb180af16b031a515
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Mon, 27 Oct 2025 21:41:20 +0530
new index
Diffstat:
| M | docs/index.html | | | 388 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- |
1 file changed, 387 insertions(+), 1 deletion(-)
diff --git a/docs/index.html b/docs/index.html
@@ -3785,7 +3785,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">(58 files)</span>
+ <span class="ml-2 text-sm text-gray-500">(65 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">
@@ -5877,6 +5877,392 @@ int main()
}</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">P038.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P038.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-P038_c', 'P038.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P038_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P038.c">
+ <pre><code class="language-c">/* Write a program to check prime number */
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+#include <stdio.h>
+#include <math.h>
+#include <stdbool.h>
+
+int main()
+{
+ int num, i, endCheckDigit;
+ bool isPrime = true;
+ printf("Enter the number : ");
+ if (scanf("%d", &num) != 1)
+ {
+ printf("\nOnly a number is allowed, not a character.");
+ return 1;
+ }
+ if (num <= 0)
+ {
+ printf("\nOnly postive number is allowed.");
+ return 1;
+ }
+ if (num == 1)
+ {
+ printf("\nInput 1 is not a prime number."
+ "\nHas only one positive divisor (itself), not exactly two."
+ "\nRule: Prime number should have exactly two distinct positive divisors: 1 and itself");
+ return 0;
+ }
+ if (num == 2)
+ {
+ printf("\nInput 2 is a prime number."
+ "\n(Note: 2 is only Even Prime Number)");
+ return 0;
+ }
+ if (num % 2 == 0)
+ {
+ printf("\nInput %d is not a prime number.", num);
+ return 0;
+ }
+ endCheckDigit = sqrt(num);
+ for (i = 3; i <= endCheckDigit; i += 2)
+ {
+ if (num % i == 0)
+ {
+ isPrime = false;
+ printf("\nInput %d is not prime number.", num);
+ return 0;
+ }
+ }
+ if (isPrime)
+ {
+ printf("\nInput %d is a prime number.", num);
+ }
+ 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">P039.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P039.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-P039_c', 'P039.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P039_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P039.c">
+ <pre><code class="language-c">/* Write a program to print all the factors of a postive integer */
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+#include <stdio.h>
+
+int main()
+{
+ int num, i;
+ printf("Enter a number : ");
+ scanf("%d", &num);
+ printf("\nFactors of %d : ", num);
+ for (i = 1; i <= num / 2; i++)
+ {
+ if (num % i == 0)
+ {
+ printf(" %d", 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">P040.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P040.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-P040_c', 'P040.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P040_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P040.c">
+ <pre><code class="language-c">/* Write a program to calculate HCF of two positive number */
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int a, b, temp;
+ printf("Enter two number : ");
+ scanf("%d %d", &a, &b);
+ while (b > 0)
+ {
+ temp = a;
+ a = b;
+ b = temp % b;
+ }
+ printf("HCF = %d", a);
+ 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">P041.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P041.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-P041_c', 'P041.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P041_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P041.c">
+ <pre><code class="language-c">/* Write a program to enter two numbers and check they are co-prime or not.
+ co-prime when HCF = 1
+*/
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int a, b, temp, temp_a, temp_b;
+ printf("Enter two number : ");
+ scanf("%d %d", &a, &b);
+ temp_a = a;
+ temp_b = b;
+ while (b > 0)
+ {
+ temp = a;
+ a = b;
+ b = temp % b;
+ }
+ if (a == 1)
+ {
+ printf("\n(%d, %d) is co-prime.", temp_a, temp_b);
+ }
+ else
+ {
+ printf("\n(%d, %d) is not co-prime.", temp_a, temp_b);
+ }
+ 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">P042.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P042.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-P042_c', 'P042.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P042_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P042.c">
+ <pre><code class="language-c">/* Write a program to accept a number and check whether the number
+is twisted prime or not. */
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+ int n, t, i, r, rev, prime = 1;
+ printf("Enter the number : ");
+ scanf("%d", &n);
+ for (i = 2; i <= (int)sqrt(n); i++)
+ {
+ if (n % i == 0)
+ {
+ prime = 0;
+ break;
+ }
+ }
+ if (prime)
+ {
+ printf("%d is a prime number.", n);
+ t = n;
+ rev = 0;
+ prime = 1;
+ while (t > 0)
+ {
+ r = t % 10;
+ rev = rev * 10 + r;
+ t = t / 10;
+ }
+ for (i = 2; i <= (int)sqrt(rev); i++)
+ {
+ if (rev % i == 0)
+ {
+ prime = 0;
+ break;
+ }
+ }
+ if (prime)
+ {
+ printf("\n%d and %d are prime numbers.. TWISTED PRIME", n, rev);
+ }
+ else
+ {
+ printf("\n%d is non prime", rev);
+ }
+ }
+ else
+ {
+ printf("\n%d is non prime.", 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">P043.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P043.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-P043_c', 'P043.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P043_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P043.c">
+ <pre><code class="language-c">/* Write a program to check palindrome number. */
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+#include <stdio.h>
+int main()
+{
+ int num, temp, rev;
+ printf("Enter the number : ");
+ scanf("%d", &num);
+ temp = num;
+ rev = 0;
+ while (temp > 0)
+ {
+ rev = (rev * 10) + (temp % 10);
+ temp /= 10;
+ }
+ if (num == rev)
+ {
+ printf("%d is a palindrome number.", num);
+ }
+ else
+ {
+ printf("%d is not a palindrome number.", num);
+ }
+ 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">P044.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P044.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-P044_c', 'P044.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-tuition-c-P044_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/tuition-c/P044.c">
+ <pre><code class="language-c">/* Write a program to input a number and check whether the
+number is Pronic number or not.
+ Pronic Number: The number which is the product of two numbers
+ which is the product of two consecutive integer.
+ Ex: 20 = 4 * 5
+*/
+/* Author - Amit Dutta, Date - 27th OCT, 2025 */
+
+// using boolean...
+/*
+#include <stdio.h>
+#include <math.h>
+#include <stdbool.h>
+
+int main()
+{
+ int num, iterationIndex;
+ bool isPronic = false;
+ printf("Enter the number : ");
+ if (scanf("%d", &num) != 1)
+ {
+ printf("\nYou have to enter a number, not an character or symbol.");
+ return 1;
+ }
+ if (num < 1)
+ {
+ printf("\nOnly postive number is allowed.");
+ return 1;
+ }
+ for (iterationIndex = 1; iterationIndex <= num / 2; iterationIndex++)
+ {
+ if (iterationIndex * (iterationIndex + 1) == num)
+ {
+ printf("\nInput %d is a Pronic Number.", num);
+ isPronic = true;
+ break;
+ }
+ }
+ if(!isPronic)
+ {
+ printf("\nInput %d is not a Pronic Number.", num);
+ }
+ return 0;
+}
+*/
+
+// using direct return method (more efficient and generally preferred)...
+
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+ int num, iterationIndex, iterationLimit;
+ printf("Enter the number : ");
+ if (scanf("%d", &num) != 1)
+ {
+ printf("\nYou have to enter a number, not an character or symbol.");
+ return 1;
+ }
+ if (num < 1)
+ {
+ printf("\nOnly postive number is allowed.");
+ return 1;
+ }
+ iterationLimit = (int)sqrt(num);
+ for (iterationIndex = 1; iterationIndex <= iterationLimit; iterationIndex++)
+ {
+ if (iterationIndex * (iterationIndex + 1) == num)
+ {
+ printf("\nInput %d is a Pronic Number.", num);
+ return 0;
+ }
+ }
+ printf("\nInput %d is not a Pronic Number.", num);
+ return 0;
+}</code></pre>
+ </div>
+ </li>
</ul>
</div>
</li>