bsc

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

commit 7daeb75003d23db0c39223187ca6a2ba0f0f22f7
parent 252de6a8939ef6d2279a374319dc62fff4364e02
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Mon,  3 Nov 2025 21:33:49 +0530

pc-03112025 _pc006 - _pc008

Diffstat:
Mdocs/index.html | 150++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Apractice-c/pc006.c | 43+++++++++++++++++++++++++++++++++++++++++++
Apractice-c/pc007.c | 32++++++++++++++++++++++++++++++++
Apractice-c/pc008.c | 31+++++++++++++++++++++++++++++++
4 files changed, 255 insertions(+), 1 deletion(-)

diff --git a/docs/index.html b/docs/index.html @@ -3862,7 +3862,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">practice-c</span> - <span class="ml-2 text-sm text-gray-500">(5 files)</span> + <span class="ml-2 text-sm text-gray-500">(8 files)</span> </div> <div class="flex items-center space-x-4"> <a href="https://github.com/notamitgamer/bsc/tree/main/practice-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"> @@ -4087,6 +4087,154 @@ 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">pc006.c</span> + <div class="ml-auto flex items-center space-x-4"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc006.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-practice-c-pc006_c', 'pc006.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + </div> + </div> + <div id="code-practice-c-pc006_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc006.c"> + <pre><code class="language-c">/* Prime number check */ +/* Author - Amit Dutta, Date - 03rd NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; + +int main() +{ + int num, i, temp; + printf(&quot;Enter the number : &quot;); + if(scanf(&quot;%d&quot;, &amp;num) != 1) { + printf(&quot;Only postive number allowed.&quot;); + return 1; + } + if(num &lt;= 0) { + printf(&quot;\nOnly potive number are allowed.&quot;); + return 1; + } + if(num == 1) { + printf(&quot;\nInput 1 is not a prime number.&quot;); + return 0; + } + if(num == 2) { + printf(&quot;\nInput 2 is a prime number.&quot;); + return 0; + } + if(num % 2 == 0) { + printf(&quot;\nInput %d is not a prime number.&quot;, num); + return 0; + } + temp = (int)sqrt(num); + for (i = 3; i &lt;= temp; i += 2) + { + if (num % i == 0) + { + printf(&quot;\nInput %d is not a prime number.&quot;, num); + return 0; + } + } + printf(&quot;\nInput %d is a prime number.&quot;, num); + return 0; +}</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">pc007.c</span> + <div class="ml-auto flex items-center space-x-4"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc007.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-practice-c-pc007_c', 'pc007.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + </div> + </div> + <div id="code-practice-c-pc007_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc007.c"> + <pre><code class="language-c">/* Armstrong number check only for three digit */ +/* Author - Amit Dutta, Date - 03rd NOVEMBER, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int num, temp1, armstrongCheck = 0; + printf(&quot;Enter a three digit number : &quot;); + if (scanf(&quot;%d&quot;, &amp;num) != 1) + { + printf(&quot;\nOnly positive number allowed.&quot;); + return 1; + } + if (num &lt; 100 || num &gt; 999) + { + printf(&quot;\nOnly Three digit postive number allowed.&quot;); + return 1; + } + temp1 = num; + while (temp1 &gt; 0) + { + armstrongCheck += (temp1 % 10) * (temp1 % 10) * (temp1 % 10); + temp1 /= 10; + } + if (armstrongCheck == num) + printf(&quot;\nInput %d is a armstrong number.&quot;, num); + else + printf(&quot;\nInput %d is not a armstrong number.&quot;, num); + return 0; +}</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">pc008.c</span> + <div class="ml-auto flex items-center space-x-4"> + <a href="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc008.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-practice-c-pc008_c', 'pc008.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + </div> + </div> + <div id="code-practice-c-pc008_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/practice-c/pc008.c"> + <pre><code class="language-c">/* Factorial upto N */ +/* Author - Amit Dutta, Date - 03rd November, 2025 */ + +#include &lt;stdio.h&gt; + +int main() +{ + int n, i; + long long fact = 1; + printf(&quot;Enter n : &quot;); + if (scanf(&quot;%d&quot;, &amp;n) != 1) + { + printf(&quot;\nOnly non-negative number allowed.&quot;); + return 1; + } + if (n &lt; 0) + { + printf(&quot;\nOnly non-negative number allowed.&quot;); + return 1; + } + if (n == 0) + { + printf(&quot;\nFactorial of 0 : 1&quot;); + return 0; + } + for (i = 1; i &lt;= n; i++) + fact *= i; + printf(&quot;\nFactorial of %d : %lld&quot;, n, fact); + return 0; +}</code></pre> + </div> + </li> </ul> </div> </li> diff --git a/practice-c/pc006.c b/practice-c/pc006.c @@ -0,0 +1,42 @@ +/* Prime number check */ +/* Author - Amit Dutta, Date - 03rd NOVEMBER, 2025 */ + +#include <stdio.h> +#include <math.h> + +int main() +{ + int num, i, temp; + printf("Enter the number : "); + if(scanf("%d", &num) != 1) { + printf("Only postive number allowed."); + return 1; + } + if(num <= 0) { + printf("\nOnly potive number are allowed."); + return 1; + } + if(num == 1) { + printf("\nInput 1 is not a prime number."); + return 0; + } + if(num == 2) { + printf("\nInput 2 is a prime number."); + return 0; + } + if(num % 2 == 0) { + printf("\nInput %d is not a prime number.", num); + return 0; + } + temp = (int)sqrt(num); + for (i = 3; i <= temp; i += 2) + { + if (num % i == 0) + { + printf("\nInput %d is not a prime number.", num); + return 0; + } + } + printf("\nInput %d is a prime number.", num); + return 0; +}+ \ No newline at end of file diff --git a/practice-c/pc007.c b/practice-c/pc007.c @@ -0,0 +1,31 @@ +/* Armstrong number check only for three digit */ +/* Author - Amit Dutta, Date - 03rd NOVEMBER, 2025 */ + +#include <stdio.h> + +int main() +{ + int num, temp1, armstrongCheck = 0; + printf("Enter a three digit number : "); + if (scanf("%d", &num) != 1) + { + printf("\nOnly positive number allowed."); + return 1; + } + if (num < 100 || num > 999) + { + printf("\nOnly Three digit postive number allowed."); + return 1; + } + temp1 = num; + while (temp1 > 0) + { + armstrongCheck += (temp1 % 10) * (temp1 % 10) * (temp1 % 10); + temp1 /= 10; + } + if (armstrongCheck == num) + printf("\nInput %d is a armstrong number.", num); + else + printf("\nInput %d is not a armstrong number.", num); + return 0; +}+ \ No newline at end of file diff --git a/practice-c/pc008.c b/practice-c/pc008.c @@ -0,0 +1,30 @@ +/* Factorial upto N */ +/* Author - Amit Dutta, Date - 03rd November, 2025 */ + +#include <stdio.h> + +int main() +{ + int n, i; + long long fact = 1; + printf("Enter n : "); + if (scanf("%d", &n) != 1) + { + printf("\nOnly non-negative number allowed."); + return 1; + } + if (n < 0) + { + printf("\nOnly non-negative number allowed."); + return 1; + } + if (n == 0) + { + printf("\nFactorial of 0 : 1"); + return 0; + } + for (i = 1; i <= n; i++) + fact *= i; + printf("\nFactorial of %d : %lld", n, fact); + return 0; +}+ \ No newline at end of file
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror