commit 8e3cb5824ca7032cc39558953e343c7a6bdcf5df parent 0a27d1dd38d84f7eb781228a446b8bb97cd91cf2 Author: Amit Dutta <amitdutta4255@gmail.com> Date: Tue, 23 Jun 2026 19:10:24 +0530 updated docs Diffstat:
| M | .github/workflows/main.yml | | | 12 | ++++++------ |
| M | .gitignore | | | 7 | +++++-- |
| D | docs/semester_1/R/Code/R_Code-1.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-10.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-11.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-12.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-13.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-14.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-15.md | | | 40 | ---------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-2.md | | | 54 | ------------------------------------------------------ |
| D | docs/semester_1/R/Code/R_Code-4.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-5.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-6.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-7.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-8.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Code-9.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/R/Code/R_Prac-1.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Prac-2.md | | | 54 | ------------------------------------------------------ |
| D | docs/semester_1/R/Code/R_Prac-3.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Prac-4.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_Prac-5.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/R/Code/R_Prac-6.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/R/Code/R_code-3.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/R/Code/index.md | | | 30 | ------------------------------ |
| D | docs/semester_1/R/index.md | | | 16 | ---------------- |
| D | docs/semester_1/R/temp.md | | | 45 | --------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-01.md | | | 88 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-02.md | | | 99 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-03.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-04.md | | | 88 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-05.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-06.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-07.md | | | 147 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-08.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-09.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-10.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-11.md | | | 120 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-12_v1.md | | | 90 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-12_v2.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-13.md | | | 90 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-14_v1.md | | | 99 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-14_v2.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/assignment-p-15.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-primary/index.md | | | 26 | -------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-01.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-02.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-03.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-04.md | | | 94 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-05.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-06.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-07.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-08.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-09.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-10.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-11.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/assignment-secondary/assignment-s-12.md | | | 82 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-13-1.md | | | 102 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-13-2.md | | | 106 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-14.md | | | 308 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-15.md | | | 92 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-16.md | | | 111 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-17.md | | | 126 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-18.md | | | 105 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-19.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-20.md | | | 356 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-21.md | | | 115 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-22.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-23.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/assignment-s-24.md | | | 76 | ---------------------------------------------------------------------------- |
| D | docs/semester_1/assignment-secondary/index.md | | | 34 | ---------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-10.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-8.md | | | 94 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-9.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-1_05-03-2026/index.md | | | 12 | ------------ |
| D | docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-11.md | | | 90 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-3.md | | | 100 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-4.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/eduincs_exam/Paper-2_05-03-2026/index.md | | | 12 | ------------ |
| D | docs/semester_1/eduincs_exam/index.md | | | 11 | ----------- |
| D | docs/semester_1/internal-practice/IP-01.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-02.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-03.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-04.md | | | 94 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-05.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-06.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-07.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-08.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/internal-practice/IP-09.md | | | 82 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-10.md | | | 112 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-11.md | | | 92 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-12.md | | | 111 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-13.md | | | 126 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-14.md | | | 105 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-15.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-16.md | | | 99 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-17.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-18.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-19.md | | | 147 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/IP-20.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/internal-practice/index.md | | | 29 | ----------------------------- |
| D | docs/semester_1/khurapati-idea/KI001.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/khurapati-idea/KI002.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/khurapati-idea/KI003.md | | | 249 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/khurapati-idea/KI004.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/khurapati-idea/index.md | | | 14 | -------------- |
| D | docs/semester_1/khurapati-idea/interpeter.md | | | 123 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/index.md | | | 149 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc001.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/letusc/luc002.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc003.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/letusc/luc004.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc005.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/letusc/luc006.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc007.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/letusc/luc008.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc009.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc010.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc011.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc012.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/letusc/luc013.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/letusc/luc014.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc015.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc016.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc017.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc018-logic.md | | | 127 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc018.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc019.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc020.md | | | 94 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc021.md | | | 94 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc022.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc023.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/letusc/luc024.md | | | 54 | ------------------------------------------------------ |
| D | docs/semester_1/letusc/luc025.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/letusc/luc026.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc027.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc028.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/letusc/luc029.md | | | 67 | ------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc030.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc031-logic.md | | | 121 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc031.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc032.md | | | 67 | ------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc033.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc034.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/letusc/luc035.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc036.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc037.md | | | 67 | ------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc038.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc039.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/letusc/luc040-logic.md | | | 164 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc040.md | | | 103 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc041.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc042.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc043.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc044.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc045.md | | | 100 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc046.md | | | 71 | ----------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc047.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc048.md | | | 212 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc049.md | | | 89 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc050.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc051.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc052.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/letusc/luc053.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc054.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc055.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc056.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc057.md | | | 76 | ---------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc058.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc059.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc060.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc061.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc062.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc063.md | | | 74 | -------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc064.md | | | 212 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc065.md | | | 87 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc066.md | | | 87 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc067.md | | | 92 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc068.md | | | 106 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc069.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc070.md | | | 88 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc071.md | | | 92 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc072.md | | | 95 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc073.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc074.md | | | 89 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc075.md | | | 106 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc076.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc077.md | | | 104 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc078.md | | | 114 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc079.md | | | 132 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc080.md | | | 93 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc081.md | | | 92 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc082.md | | | 98 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc083.md | | | 167 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc084.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc085.md | | | 111 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc086.md | | | 98 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc087.md | | | 117 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc088.md | | | 104 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc089.md | | | 147 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc090.md | | | 118 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc091.md | | | 98 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc092.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc093.md | | | 160 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc094.md | | | 95 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc095.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc096.md | | | 89 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc097.md | | | 131 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc098.md | | | 109 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc099.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc100.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc101.md | | | 85 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc102.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc103.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc104.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc105.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc106.md | | | 67 | ------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc107.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc108.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc109.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc110.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/luc111.md | | | 71 | ----------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc112.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc113.md | | | 116 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc114.md | | | 93 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc115.md | | | 241 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc116.md | | | 200 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc117.md | | | 119 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc118.md | | | 98 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/luc119.md | | | 104 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem001.md | | | 71 | ----------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem002.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem003.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem004.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem005.md | | | 76 | ---------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem006.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem007.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/letusc/lucproblem008.md | | | 76 | ---------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem009.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem010-complex.md | | | 94 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem010.md | | | 95 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem011.md | | | 227 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem012.md | | | 71 | ----------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem013.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem014-short.md | | | 100 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem014.md | | | 142 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem015.md | | | 85 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/letusc/lucproblem016.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/external_1.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/practice-c/external_2.md | | | 53 | ----------------------------------------------------- |
| D | docs/semester_1/practice-c/external_3.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/practice-c/external_4.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/practice-c/external_5.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/practice-c/external_6.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/practice-c/external_7.md | | | 50 | -------------------------------------------------- |
| D | docs/semester_1/practice-c/external_8.md | | | 51 | --------------------------------------------------- |
| D | docs/semester_1/practice-c/index.md | | | 54 | ------------------------------------------------------ |
| D | docs/semester_1/practice-c/pc-ip-01.md | | | 85 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-02.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-03.md | | | 74 | -------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-04.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-05.md | | | 89 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-06.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-07.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-08.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/practice-c/pc-ip-09.md | | | 107 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-10.md | | | 112 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-11.md | | | 141 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-12.md | | | 120 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-13.md | | | 103 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-14.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-15.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-16.md | | | 84 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-17.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-18.md | | | 113 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-19.md | | | 130 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc-ip-20.md | | | 103 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc001.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc002.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc003.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc004.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc005.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/practice-c/pc006.md | | | 84 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc007.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc008.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/practice-c/pc009.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc010.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc011.md | | | 89 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc012.md | | | 90 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc013.md | | | 118 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc014.md | | | 95 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc015.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/practice-c/pc016.md | | | 151 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/practice-c/pc017.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/temp/index.md | | | 13 | ------------- |
| D | docs/semester_1/temp/maheswar01.md | | | 217 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/temp/maheswar02.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/temp/sudipto1.md | | | 163 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/temp/sudiptoown01.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-001.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-002.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-003.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-PRAC-004.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-005.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-006.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-007.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-008.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-009.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-010.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-011.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-012.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-013.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-014.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-015.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-016.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-017.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-018.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-019.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-020.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-021.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-PRAC-022.md | | | 91 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-023.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-024.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-025.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-026.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-027.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-028.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-029.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-030.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-031.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-032.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-033.md | | | 75 | --------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-034.md | | | 76 | ---------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-035.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-PRAC-036.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-037.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-038.md | | | 67 | ------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-039.md | | | 70 | ---------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-040.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-041.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-PRAC-042.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-001.md | | | 49 | ------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-002.md | | | 46 | ---------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-003.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-004.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-S-005.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-006.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-S-007.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-008.md | | | 99 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-009.md | | | 104 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-010.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-S-011.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-012.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-013.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-S-014.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-001.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-002.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-003.md | | | 54 | ------------------------------------------------------ |
| D | docs/semester_1/tuition-c/APC-SPS-004.md | | | 46 | ---------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-005.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-006.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-007.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/APC-SPS-008.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P001.md | | | 43 | ------------------------------------------- |
| D | docs/semester_1/tuition-c/P002.md | | | 43 | ------------------------------------------- |
| D | docs/semester_1/tuition-c/P003.md | | | 51 | --------------------------------------------------- |
| D | docs/semester_1/tuition-c/P004.md | | | 52 | ---------------------------------------------------- |
| D | docs/semester_1/tuition-c/P005.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P006.md | | | 52 | ---------------------------------------------------- |
| D | docs/semester_1/tuition-c/P007.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P008.md | | | 57 | --------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P009.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P010.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P011.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P012.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P013.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P014.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P015.md | | | 58 | ---------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P016.md | | | 55 | ------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P017.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P018.md | | | 67 | ------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P019.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P020.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P021.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P022.md | | | 56 | -------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P023.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P024.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P025.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P026.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P027.md | | | 98 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P028.md | | | 73 | ------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P029.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P030.md | | | 101 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P031.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P032.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P033.md | | | 65 | ----------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P034.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P035.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P036.md | | | 59 | ----------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P037.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P038.md | | | 98 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P039.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P040.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P041.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P042.md | | | 96 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P043.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P044.md | | | 112 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P045.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P046.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P047.md | | | 62 | -------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P048.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P049.md | | | 66 | ------------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P050-SHORT.md | | | 68 | -------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P050.md | | | 72 | ------------------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P051.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P052.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P053.md | | | 195 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P054.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P055.md | | | 76 | ---------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P056.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P057.md | | | 63 | --------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P058.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_1/tuition-c/P059.md | | | 97 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P060.md | | | 93 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P061.md | | | 82 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P062.md | | | 100 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P063.md | | | 93 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P064.md | | | 92 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P065.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P066.md | | | 69 | --------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P067.md | | | 74 | -------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P068.md | | | 83 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P069.md | | | 99 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/P070.md | | | 88 | ------------------------------------------------------------------------------- |
| D | docs/semester_1/tuition-c/index.md | | | 144 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/algorithms/algo_01.md | | | 33 | --------------------------------- |
| D | docs/semester_2/algorithms/algo_02.md | | | 29 | ----------------------------- |
| D | docs/semester_2/algorithms/algo_03.md | | | 30 | ------------------------------ |
| D | docs/semester_2/algorithms/algo_04.md | | | 32 | -------------------------------- |
| D | docs/semester_2/algorithms/algo_05.md | | | 35 | ----------------------------------- |
| D | docs/semester_2/algorithms/algo_06.md | | | 37 | ------------------------------------- |
| D | docs/semester_2/algorithms/algo_07.md | | | 31 | ------------------------------- |
| D | docs/semester_2/algorithms/algo_08.md | | | 34 | ---------------------------------- |
| D | docs/semester_2/algorithms/index.md | | | 17 | ----------------- |
| D | docs/semester_2/practice/index.md | | | 21 | --------------------- |
| D | docs/semester_2/practice/prac_001.md | | | 60 | ------------------------------------------------------------ |
| D | docs/semester_2/practice/prac_002.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_003.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_004.md | | | 78 | ------------------------------------------------------------------------------ |
| D | docs/semester_2/practice/prac_005.md | | | 82 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_006.md | | | 80 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_007.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_008.md | | | 77 | ----------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_009.md | | | 81 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_010.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_011.md | | | 93 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/practice/prac_012.md | | | 79 | ------------------------------------------------------------------------------- |
| D | docs/semester_2/python/code_01.md | | | 64 | ---------------------------------------------------------------- |
| D | docs/semester_2/python/index.md | | | 10 | ---------- |
| D | docs/semester_2/tuition/apc_001.md | | | 61 | ------------------------------------------------------------- |
| D | docs/semester_2/tuition/index.md | | | 10 | ---------- |
460 files changed, 11 insertions(+), 36064 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml @@ -85,16 +85,15 @@ jobs: git log --pretty=format:"%H|%s|%an|%aI" -20 > git_log.txt python changelog.py - - name: Commit generated docs and changelog to repo + - name: Commit generated changelog to repo run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - if [ -d docs ]; then - git add docs - fi + git add CHANGELOG.md + if ! git diff --cached --quiet; then - git commit -m "chore: update generated docs and changelog [skip ci]" + git commit -m "chore: update changelog [skip ci]" git push else echo "No changes" @@ -129,4 +128,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v4+ \ No newline at end of file diff --git a/.gitignore b/.gitignore @@ -15,4 +15,7 @@ node_modules/ __pycache__/ *.py[cod] .DS_Store -Thumbs.db- \ No newline at end of file +Thumbs.db +docs/semester_*/ +!docs/semester_*/index.md +!docs/semester_1/model_questions.md+ \ No newline at end of file diff --git a/docs/semester_1/R/Code/R_Code-1.md b/docs/semester_1/R/Code/R_Code-1.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-1.r' -description: 'R allows you to assign values to variables in three different ways.' -source: 'semester_1/R/Code/R_Code-1.r' ---- - -# R_Code-1.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -R allows you to assign values to variables in three different ways. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-1.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-1.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-1.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# R allows you to assign values to variables in three different ways. - -# Write three lines of code assigning the string "R is fun" to a variable -# using Simple Assignment, Leftward Assignment, and Rightward Assignment. - -simple = "R is fun" -left <- "R is fun" -"R is fun" -> right -``` diff --git a/docs/semester_1/R/Code/R_Code-10.md b/docs/semester_1/R/Code/R_Code-10.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-10.r' -description: 'Create a numeric vector of student exam scores. Write a single line of code that evaluates these scores and outputs "Pass" for any score 50 or above, and "Fail" for any score below 50.' -source: 'semester_1/R/Code/R_Code-10.r' ---- - -# R_Code-10.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 20 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create a numeric vector of student exam scores. Write a single line of code that evaluates these scores and outputs "Pass" for any score 50 or above, and "Fail" for any score below 50. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-10.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-10.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-10.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Create a numeric vector of student exam scores. -# Write a single line of code that evaluates these scores and -# outputs "Pass" for any score 50 or above, and "Fail" for any score below 50. - -score <- c(45, 26, 89, 21, 75, 99, 13, 68, 85) - -ifelse(score < 50, "Fail", "Pass") -``` diff --git a/docs/semester_1/R/Code/R_Code-11.md b/docs/semester_1/R/Code/R_Code-11.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-11.r' -description: 'Write a while loop that starts with a multiplier of 1. The loop should multiply the current multiplier by 4, assign it to a result variable, and print the result. The loop should exit if the result exceeds 100; otherwise, increment the multiplier by 1.' -source: 'semester_1/R/Code/R_Code-11.r' ---- - -# R_Code-11.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 20 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a while loop that starts with a multiplier of 1. The loop should multiply the current multiplier by 4, assign it to a result variable, and print the result. The loop should exit if the result exceeds 100; otherwise, increment the multiplier by 1. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-11.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-11.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-11.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Write a while loop that starts with a multiplier of 1. -# The loop should multiply the current multiplier by 4, -# assign it to a result variable, and print the result. -# The loop should exit if the result exceeds 100; otherwise, -# increment the multiplier by 1. - -num = 1 -while(TRUE) { - result <- num * 4 - print(result) - - if (result > 100) { - break - } - num = num + 1 -} -``` diff --git a/docs/semester_1/R/Code/R_Code-12.md b/docs/semester_1/R/Code/R_Code-12.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-12.r' -description: 'Write a custom function named calculate_area that takes two parameters: length and width. The width parameter should have a default value of 5. The function should print the product of the two parameters. Finally, call your function passing only the value 12 for the length.' -source: 'semester_1/R/Code/R_Code-12.r' ---- - -# R_Code-12.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 20 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a custom function named calculate_area that takes two parameters: length and width. The width parameter should have a default value of 5. The function should print the product of the two parameters. Finally, call your function passing only the value 12 for the length. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-12.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-12.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-12.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Write a custom function named calculate_area that takes -# two parameters: length and width. The width parameter should have -# a default value of 5. The function should print the product of the -# two parameters. Finally, call your function passing only the value 12 for the length. - -calculate_area <- function(length, width = 5) { - print(length * width) -} - -calculate_area(12) -``` diff --git a/docs/semester_1/R/Code/R_Code-13.md b/docs/semester_1/R/Code/R_Code-13.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-13.r' -description: 'Create a list named student_record containing a string, an integer, and a numeric vector of two grades. Then, add the logical value TRUE to the end of the list, ensuring the original student_record variable is updated. Print the final list.' -source: 'semester_1/R/Code/R_Code-13.r' ---- - -# R_Code-13.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 20 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create a list named student_record containing a string, an integer, and a numeric vector of two grades. Then, add the logical value TRUE to the end of the list, ensuring the original student_record variable is updated. Print the final list. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-13.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-13.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-13.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Create a list named student_record containing a string, -# an integer, and a numeric vector of two grades. Then, add the -# logical value TRUE to the end of the list, ensuring the original -# student_record variable is updated. Print the final list. - -student_record <- list("Amit Dutta", 95, c(95, 96)) -print(student_record) -student_record <- append(student_record, TRUE) -print(student_record) -``` diff --git a/docs/semester_1/R/Code/R_Code-14.md b/docs/semester_1/R/Code/R_Code-14.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-14.r' -description: 'Write an if...else if...else block that evaluates a newly created temperature variable. * If the temperature is strictly greater than 30, print: "30+ is too hot!" * If the temperature is between 20 and 30 (inclusive), print: "Perfect weather." * Otherwise, print: "It is quite cold."' -source: 'semester_1/R/Code/R_Code-14.r' ---- - -# R_Code-14.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 20 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write an if...else if...else block that evaluates a newly created temperature variable. * If the temperature is strictly greater than 30, print: "30+ is too hot!" * If the temperature is between 20 and 30 (inclusive), print: "Perfect weather." * Otherwise, print: "It is quite cold." -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-14.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-14.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-14.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Write an if...else if...else block that evaluates a newly created temperature variable. -# * If the temperature is strictly greater than 30, print: "30+ is too hot!" -# * If the temperature is between 20 and 30 (inclusive), print: "Perfect weather." -# * Otherwise, print: "It is quite cold." - -temperature <- 29 -if(temperature > 30) { - print("30+ is too hot!") -} else if(temperature >= 20 && temperature <= 30) { - print("Perfect weather") -} else { - print("It is quite cold.") -} -``` diff --git a/docs/semester_1/R/Code/R_Code-15.md b/docs/semester_1/R/Code/R_Code-15.md @@ -1,40 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-15.r' -description: 'R program — R_Code-15.r' -source: 'semester_1/R/Code/R_Code-15.r' ---- - -# R_Code-15.r - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-15.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-15.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-15.r] -# Asking for a name -name <- readline(prompt = "Enter your name: ") - -# Asking for a number (requires conversion) -age <- readline(prompt = "Enter your age: ") -age <- as.numeric(age) - -print(paste("Hello", name, "you are", age, "years old.")) -``` diff --git a/docs/semester_1/R/Code/R_Code-2.md b/docs/semester_1/R/Code/R_Code-2.md @@ -1,54 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-2.r' -description: 'How do you declare an explicitly integer variable (e.g., the number 14) so that its class returns "integer" instead of the default floating-point "numeric"?' -source: 'semester_1/R/Code/R_Code-2.r' ---- - -# R_Code-2.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -How do you declare an explicitly integer variable (e.g., the number 14) so that its class returns "integer" instead of the default floating-point "numeric"? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-2.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-2.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-2.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# How do you declare an explicitly integer variable (e.g., the number 14) -# so that its class returns "integer" instead of the default floating-point "numeric"? - -num <- 12L -print(class(num)) -``` diff --git a/docs/semester_1/R/Code/R_Code-4.md b/docs/semester_1/R/Code/R_Code-4.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-4.r' -description: 'Write a standard if...else block that checks if a variable named age is greater than 18. If the condition is true, print "You are eligible to vote.", otherwise print "You cannot vote.".' -source: 'semester_1/R/Code/R_Code-4.r' ---- - -# R_Code-4.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a standard if...else block that checks if a variable named age is greater than 18. If the condition is true, print "You are eligible to vote.", otherwise print "You cannot vote.". -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-4.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-4.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-4.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Write a standard if...else block that checks if a variable named -# age is greater than 18. If the condition is true, print "You are eligible to vote.", -# otherwise print "You cannot vote.". - -age <- -1 -if (age < 0) { - print("Not a valid age.") -} else if (age < 18) { - print("Not eligible to vote.") -} else { - print("Eligible to vote.") -} -``` diff --git a/docs/semester_1/R/Code/R_Code-5.md b/docs/semester_1/R/Code/R_Code-5.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-5.r' -description: 'You have a vector of numbers: x <- c(12, 9, 23, 14). Use R''s shorthand ifelse() function to output "EVEN" if a number in the vector is divisible by 2 (x %% 2 == 0), and "ODD" if it is not.' -source: 'semester_1/R/Code/R_Code-5.r' ---- - -# R_Code-5.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -You have a vector of numbers: x <- c(12, 9, 23, 14). Use R's shorthand ifelse() function to output "EVEN" if a number in the vector is divisible by 2 (x %% 2 == 0), and "ODD" if it is not. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-5.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-5.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-5.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# You have a vector of numbers: x <- c(12, 9, 23, 14). -# Use R's shorthand ifelse() function to output "EVEN" if a number -# in the vector is divisible by 2 (x %% 2 == 0), and "ODD" if it is not. - -x <- c(12, 9, 23, 14) -ifelse(x %% 2 == 0, "EVEN", "ODD") -``` diff --git a/docs/semester_1/R/Code/R_Code-6.md b/docs/semester_1/R/Code/R_Code-6.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-6.r' -description: 'Write a while loop with a number variable starting at 1. The loop should print the number and increment it by 1, but you must include an if statement with a break command to stop the loop''s execution exactly when number == 6' -source: 'semester_1/R/Code/R_Code-6.r' ---- - -# R_Code-6.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a while loop with a number variable starting at 1. The loop should print the number and increment it by 1, but you must include an if statement with a break command to stop the loop's execution exactly when number == 6 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-6.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-6.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-6.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Write a while loop with a number variable starting at 1. -# The loop should print the number and increment it by 1, -# but you must include an if statement with a break command to -# stop the loop's execution exactly when number == 6 - -number <- 1 -while (TRUE) { - if(number == 6) { - break - } - print(number) - number = number + 1 -} -``` diff --git a/docs/semester_1/R/Code/R_Code-7.md b/docs/semester_1/R/Code/R_Code-7.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-7.r' -description: 'Create a numerical vector containing the sequence of numbers from 1 to 5 using the : operator. Then, use the rep() function with the times argument to repeat that entire sequence exactly 2 times.' -source: 'semester_1/R/Code/R_Code-7.r' ---- - -# R_Code-7.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create a numerical vector containing the sequence of numbers from 1 to 5 using the : operator. Then, use the rep() function with the times argument to repeat that entire sequence exactly 2 times. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-7.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-7.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-7.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Create a numerical vector containing the sequence of -# numbers from 1 to 5 using the : operator. Then, use the rep() -# function with the times argument to repeat that entire sequence exactly 2 times. - -s <- rep(c(1:5), times= 2) -print(s) -``` diff --git a/docs/semester_1/R/Code/R_Code-8.md b/docs/semester_1/R/Code/R_Code-8.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-8.r' -description: 'Create a list named list1 containing the number 24, the string "Sabby", the float 5.4, and the string "Nepal". Then, write the code using the append() function to add the number 3.14 to the very end of this list.' -source: 'semester_1/R/Code/R_Code-8.r' ---- - -# R_Code-8.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create a list named list1 containing the number 24, the string "Sabby", the float 5.4, and the string "Nepal". Then, write the code using the append() function to add the number 3.14 to the very end of this list. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-8.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-8.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-8.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Create a list named list1 containing the number 24, -# the string "Sabby", the float 5.4, and the string "Nepal". -# Then, write the code using the append() function to add the number 3.14 to the very end of this list. - -list1 <- list(24L, "Sabby", 5.4, "Nepal") -print("Before update") -print(list1) -print("After Update") -list1 <- append(list1, 3.14) -print(list1) -``` diff --git a/docs/semester_1/R/Code/R_Code-9.md b/docs/semester_1/R/Code/R_Code-9.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Code-9.r' -description: 'Define a function called power that takes two parameters, a and b. Give a a default value of 2. The function should print the result of a raised to the power of b (a^b).' -source: 'semester_1/R/Code/R_Code-9.r' ---- - -# R_Code-9.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Define a function called power that takes two parameters, a and b. Give a a default value of 2. The function should print the result of a raised to the power of b (a^b). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Code-9.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Code-9.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Code-9.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Define a function called power that takes two parameters, -# a and b. Give a a default value of 2. The function should print the result -# of a raised to the power of b (a^b). - -power <- function (a = 2, b) { - return (a^b) -} -a <- 2 -b <- 3 -print(power(a, b)) -print(power("b" = b)) -``` diff --git a/docs/semester_1/R/Code/R_Prac-1.md b/docs/semester_1/R/Code/R_Prac-1.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Prac-1.r' -description: 'Write a R program to print numbers from 1 to 5.' -source: 'semester_1/R/Code/R_Prac-1.r' ---- - -# R_Prac-1.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 25 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a R program to print numbers from 1 to 5. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Prac-1.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Prac-1.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Prac-1.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Write a R program to print numbers from 1 to 5. - -i = 1 -while(i <= 5) { - print(i) - i = i + 1 -} -# or we can use -print(1:5) -``` diff --git a/docs/semester_1/R/Code/R_Prac-2.md b/docs/semester_1/R/Code/R_Prac-2.md @@ -1,54 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Prac-2.r' -description: 'Check whether a number is even or odd.' -source: 'semester_1/R/Code/R_Prac-2.r' ---- - -# R_Prac-2.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 25 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Check whether a number is even or odd. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Prac-2.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Prac-2.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Prac-2.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Check whether a number is even or odd. - -num <- readline(prompt="Enter the number: ") -num <- as.integer(num) -print(paste(num, "is", ifelse(num %% 2 == 0, "EVEN", "ODD"), "number.")) -``` diff --git a/docs/semester_1/R/Code/R_Prac-3.md b/docs/semester_1/R/Code/R_Prac-3.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Prac-3.r' -description: 'Print elements of vector using for loop.' -source: 'semester_1/R/Code/R_Prac-3.r' ---- - -# R_Prac-3.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 25 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Print elements of vector using for loop. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Prac-3.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Prac-3.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Prac-3.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Print elements of vector using for loop. - -sample <- c(1:6) -for(elem in sample) { - print(elem) -} -``` diff --git a/docs/semester_1/R/Code/R_Prac-4.md b/docs/semester_1/R/Code/R_Prac-4.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Prac-4.r' -description: 'Program to add two numbers in R program.' -source: 'semester_1/R/Code/R_Prac-4.r' ---- - -# R_Prac-4.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 25 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Program to add two numbers in R program. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Prac-4.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Prac-4.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Prac-4.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Program to add two numbers in R program. - -num1 <- as.double(readline(prompt="Enter 1st number: ")) -num2 <- as.double(readline(prompt="Enter 2nd number: ")) -if(is.na(num1) || is.na(num2)) { - stop("You did not enter a valid number.") -} -print(paste("Result", num1 + num2)) -``` diff --git a/docs/semester_1/R/Code/R_Prac-5.md b/docs/semester_1/R/Code/R_Prac-5.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Prac-5.r' -description: 'Program to count the number of even numbers stored inside a vector of numbers.' -source: 'semester_1/R/Code/R_Prac-5.r' ---- - -# R_Prac-5.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 25 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Program to count the number of even numbers stored inside a vector of numbers. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Prac-5.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Prac-5.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Prac-5.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Program to count the number of even numbers stored inside a vector of numbers. - -print("Enter your numbers: ") -nums <- as.integer(scan()) -count = 0 -for(i in nums) { - if(i %% 2 == 0) { - count = count + 1 - } -} -print(paste("Even Count=", count)) -``` diff --git a/docs/semester_1/R/Code/R_Prac-6.md b/docs/semester_1/R/Code/R_Prac-6.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_Prac-6.r' -description: 'Program to access List elements, modify a List Element, add items to List, Remove items from a List, length of List.' -source: 'semester_1/R/Code/R_Prac-6.r' ---- - -# R_Prac-6.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 25 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Program to access List elements, modify a List Element, add items to List, Remove items from a List, length of List. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_Prac-6.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_Prac-6.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_Prac-6.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Program to access List elements, modify a List Element, add items to List, -# Remove items from a List, length of List. - -l <- list("Amit", 19, "Madhyamgram", 94.5) -print("Initial list:") -print(l) - -l[[4]] = 95.46 -print("after modifing last element: ") -print(l) - -l[length(l) + 1] <- "hello" -print("after adding new element:") -print(l) - -l[3] <- NULL -print("after deleting a element: ") -print(l) - -print(paste("length of the list after modifing:", length(l))) -``` diff --git a/docs/semester_1/R/Code/R_code-3.md b/docs/semester_1/R/Code/R_code-3.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> R_code-3.r' -description: 'Assume you have a variable company <- "Programiz". Write a line of code using the paste0() function to print "Welcome toProgramiz" ensuring there is no default space between the string and the variable.' -source: 'semester_1/R/Code/R_code-3.r' ---- - -# R_code-3.r - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 19 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Assume you have a variable company <- "Programiz". Write a line of code using the paste0() function to print "Welcome toProgramiz" ensuring there is no default space between the string and the variable. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/Code/R_code-3.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/Code/R_code-3.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [R_code-3.r] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Assume you have a variable company <- "Programiz". -# Write a line of code using the paste0() function to print "Welcome toProgramiz" -# ensuring there is no default space between the string and the variable. - -company <- "Programiz" -print(paste0("welcome to", company)) -``` diff --git a/docs/semester_1/R/Code/index.md b/docs/semester_1/R/Code/index.md @@ -1,30 +0,0 @@ -# Code - -Files and sub-folders in **Code**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `R_Code-1.r` | [View Code](R_Code-1.md) | -| 2 | `R_Code-10.r` | [View Code](R_Code-10.md) | -| 3 | `R_Code-11.r` | [View Code](R_Code-11.md) | -| 4 | `R_Code-12.r` | [View Code](R_Code-12.md) | -| 5 | `R_Code-13.r` | [View Code](R_Code-13.md) | -| 6 | `R_Code-14.r` | [View Code](R_Code-14.md) | -| 7 | `R_Code-15.r` | [View Code](R_Code-15.md) | -| 8 | `R_Code-2.r` | [View Code](R_Code-2.md) | -| 9 | `R_Code-4.r` | [View Code](R_Code-4.md) | -| 10 | `R_Code-5.r` | [View Code](R_Code-5.md) | -| 11 | `R_Code-6.r` | [View Code](R_Code-6.md) | -| 12 | `R_Code-7.r` | [View Code](R_Code-7.md) | -| 13 | `R_Code-8.r` | [View Code](R_Code-8.md) | -| 14 | `R_Code-9.r` | [View Code](R_Code-9.md) | -| 15 | `R_Prac-1.r` | [View Code](R_Prac-1.md) | -| 16 | `R_Prac-2.r` | [View Code](R_Prac-2.md) | -| 17 | `R_Prac-3.r` | [View Code](R_Prac-3.md) | -| 18 | `R_Prac-4.r` | [View Code](R_Prac-4.md) | -| 19 | `R_Prac-5.r` | [View Code](R_Prac-5.md) | -| 20 | `R_Prac-6.r` | [View Code](R_Prac-6.md) | -| 21 | `R_code-3.r` | [View Code](R_code-3.md) | - diff --git a/docs/semester_1/R/index.md b/docs/semester_1/R/index.md @@ -1,16 +0,0 @@ -# R - -Files and sub-folders in **R**. - -## Folders - -| # | Folder | Link | -|---|---|---| -| 1 | Code | [Open](Code/index.md) | - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `temp.r` | [View Code](temp.md) | - diff --git a/docs/semester_1/R/temp.md b/docs/semester_1/R/temp.md @@ -1,45 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> temp.r' -description: 'R program — temp.r' -source: 'semester_1/R/temp.r' ---- - -# temp.r - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/R/temp.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/R/temp.r" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```r [temp.r] -s1 = rep(c(1,2,3,4,5), times=2) -s2 = c(5,4,3,2,1) -count = 0 -for(i in s1) { - for (j in s2) { - if((i+j) %% 2 == 0) { - count = count + 1 - print(sprintf("%d, %d, %d", i, j, count)) - print(length(s1)) - } - } -} -2^3 -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-01.md b/docs/semester_1/assignment-primary/assignment-p-01.md @@ -1,88 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-01.c' -description: 'Write a C program that includes a user-defined function named isPrime with the signature int isPrime(int num); The function should take an integer as a parameter and return 1 if the number is prime and 0 otherwise.' -source: 'semester_1/assignment-primary/assignment-p-01.c' ---- - -# assignment-p-01.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named isPrime with the signature int isPrime(int num); The function should take an integer as a parameter and return 1 if the number is prime and 0 otherwise. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-01.c] -#include <stdio.h> -#include <math.h> - -int isPrime(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - - if (isPrime(n)) - { - printf("\nInput %d is a Prime Number.", n); - } - else - { - printf("\nInput %d is not a Prime Number.", n); - } - - return 0; -} - -int isPrime(int n) -{ - if (n <= 1) - return 0; - if (n == 2) - return 1; - if (n % 2 == 0) - return 0; - - int temp = (int)sqrt(n); - int i; - for (i = 3; i <= temp; i += 2) - { - if (n % i == 0) - { - return 0; - } - } - return 1; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-02.md b/docs/semester_1/assignment-primary/assignment-p-02.md @@ -1,99 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-02.c' -description: 'Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);. An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153' -source: 'semester_1/assignment-primary/assignment-p-02.c' ---- - -# assignment-p-02.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);. An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-02.c] -#include <stdio.h> -#include <math.h> - -int isArmstrong(int); -int count(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - - if (isArmstrong(n)) - { - printf("\nInput %d is a Armstrong Number.", n); - } - else - { - printf("\nInput %d is Not a Armstrong Number.", n); - } - - return 0; -} - -int count(int n) -{ - int count = 0; - while (n > 0) - { - count++; - n = n / 10; - } - return count; -} - -int isArmstrong(int n) -{ - if (n < 0) - return 0; - if (n == 0) - return 1; - - int power = count(n); - int temp = n; - int checker = 0; - - while (temp > 0) - { - int digit = temp % 10; - checker = checker + (int)round(pow(digit, power)); - temp = temp / 10; - } - return n == checker; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-03.md b/docs/semester_1/assignment-primary/assignment-p-03.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-03.c' -description: 'Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, 28 is a perfect number because the sum of its divisors (1, 2, 4, 7, 14) equals 28.' -source: 'semester_1/assignment-primary/assignment-p-03.c' ---- - -# assignment-p-03.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, 28 is a perfect number because the sum of its divisors (1, 2, 4, 7, 14) equals 28. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-03.c] -#include <stdio.h> - -int isPerfect(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - if (isPerfect(n)) - { - printf("\nInput %d is a Perfect Number.", n); - } - else - { - printf("\nInput %d is not a Perfect Number.", n); - } - return 0; -} - -int isPerfect(int n) -{ - if (n <= 1) - return 0; - int temp = 1; - int i; - for (i = 2; i <= n / 2; i++) - { - if (n % i == 0) - { - temp += i; - } - } - return temp == n; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-04.md b/docs/semester_1/assignment-primary/assignment-p-04.md @@ -1,88 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-04.c' -description: 'Write a C program that takes an integer input representing a month (1 to 12) and a year. Use a switch statement to display the number of days in that month, considering leap years.' -source: 'semester_1/assignment-primary/assignment-p-04.c' ---- - -# assignment-p-04.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that takes an integer input representing a month (1 to 12) and a year. Use a switch statement to display the number of days in that month, considering leap years. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-04.c] -#include <stdio.h> - -int main() -{ - int month, year, days; - printf("Enter the month (1 to 12) and year: "); - scanf("%d %d", &month, &year); - - switch (month) - { - case 1: // jan - case 3: // mar - case 5: // may - case 7: // july - case 8: // aug - case 10: // oct - case 12: // dec - days = 31; - break; - case 4: // apr - case 6: // jun - case 9: // sep - case 11: // nov - days = 30; - break; - case 2: // feb - if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) - { - days = 29; - } - else - { - days = 28; - } - break; - default: - printf("\nYou entered something wrong."); - return 0; - } - - printf("\nNumber of days: %d", days); - return 0; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-05.md b/docs/semester_1/assignment-primary/assignment-p-05.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-05.c' -description: 'Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);. The function should reverse the elements of the array.' -source: 'semester_1/assignment-primary/assignment-p-05.c' ---- - -# assignment-p-05.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);. The function should reverse the elements of the array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-05.c] -#include <stdio.h> - -void inputArray(int[], int); -void reverseArray(int[], int); - -int main() -{ - int size; - printf("How many element do you want to add: "); - scanf("%d", &size); - int arr[size]; - inputArray(arr, size); - reverseArray(arr, size); - return 0; -} - -void inputArray(int arr[], int size) -{ - int i; - for (i = 0; i < size; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void reverseArray(int arr[], int size) -{ - int i, j, temp; - printf("\nBefore Reverse: \n"); - for (i = 0; i < size; i++) - { - printf("Position: %d, Value: %d\n", i, arr[i]); - } - for (i = 0, j = size - 1; i < j; i++, j--) - { - temp = arr[i]; - arr[i] = arr[j]; - arr[j] = temp; - } - printf("\nAfter Reverse: \n"); - for (i = 0; i < size; i++) - { - printf("Position: %d, Value: %d\n", i, arr[i]); - } -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-06.md b/docs/semester_1/assignment-primary/assignment-p-06.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-06.c' -description: 'Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);. The function should take an array of integers and its size, and return the largest element in the array.' -source: 'semester_1/assignment-primary/assignment-p-06.c' ---- - -# assignment-p-06.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);. The function should take an array of integers and its size, and return the largest element in the array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-06.c] -#include <stdio.h> - -void inputArray(int[], int); -int findLargest(int[], int); - -int main() -{ - int size; - printf("How many element do you want to enter: "); - scanf("%d", &size); - int arr[size]; - inputArray(arr, size); - printf("\nLargest Element is: %d", findLargest(arr, size)); - return 0; -} - -void inputArray(int arr[], int size) -{ - int i; - for (i = 0; i < size; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int findLargest(int arr[], int size) -{ - int largest = arr[0], i; - for (i = 1; i < size; i++) - { - if (largest < arr[i]) - { - largest = arr[i]; - } - } - return largest; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-07.md b/docs/semester_1/assignment-primary/assignment-p-07.md @@ -1,147 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-07.c' -description: 'Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);. The function should perform a binary search on a sorted array of integers and return the index of the target element if found, and -1 otherwise.' -source: 'semester_1/assignment-primary/assignment-p-07.c' ---- - -# assignment-p-07.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);. The function should perform a binary search on a sorted array of integers and return the index of the target element if found, and -1 otherwise. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-07.c] -#include <stdio.h> - -int inputArray(int[], int); -// void sortArray(int[], int); -int binarySearch(int[], int, int); - -int main() -{ - int size; - printf("How many element do you want to enter: "); - scanf("%d", &size); - int arr[size]; - int target = inputArray(arr, size); - // sortArray(arr, size); - int index = binarySearch(arr, size, target); - if (index != -1) - { - printf("\nElement %d is found at index %d.", target, index); - } - else - { - printf("\nElement %d is not found.", target); - } - return 0; -} - -int inputArray(int arr[], int size) -{ - int i, target; - for (i = 0; i < size; i++) - { - printf("Enter element for position %d: ", i); - scanf("%d", &arr[i]); - } - printf("\nEnter the target element: "); - scanf("%d", &target); - return target; -} - -/* void sortArray(int arr[], int size) -{ - // using Bubble Sort... - - int tempArr[size], i, j, temp; - printf("\nBefore Sorting:\n["); - for (i = 0; i < size; i++) - { - printf("%d", arr[i]); - if (i != size - 1) - { - printf(", "); - } - } - printf("]\n"); - for (i = 0; i < size - 1; i++) - { - for (j = 0; j < size - i - 1; j++) - { - if (arr[j] > arr[j + 1]) - { - temp = arr[j]; - arr[j] = arr[j + 1]; - arr[j + 1] = temp; - } - } - } - printf("\nAfter Sorting:\n["); - for (i = 0; i < size; i++) - { - printf("%d", arr[i]); - if (i != size - 1) - { - printf(", "); - } - } - printf("]\n"); -} -*/ - -int binarySearch(int arr[], int size, int target) -{ - int low = 0; - int high = size - 1; - int mid; - while (low <= high) - { - mid = low + ((high - low) / 2); - if (arr[mid] == target) - { - return mid; - } - else if (arr[mid] > target) - { - high = mid - 1; - } - else if (arr[mid] < target) - { - low = mid + 1; - } - } - return -1; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-08.md b/docs/semester_1/assignment-primary/assignment-p-08.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-08.c' -description: 'Write a C program that includes a user-defined function named countSetBits with the signature int countSetBits(int num);. The function should count and return the number of set bits (1s) in the binary representation of the given number.' -source: 'semester_1/assignment-primary/assignment-p-08.c' ---- - -# assignment-p-08.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named countSetBits with the signature int countSetBits(int num);. The function should count and return the number of set bits (1s) in the binary representation of the given number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-08.c] -#include <stdio.h> - -int countSetBits(int); - -int main() -{ - int num, result; - printf("Enter the number: "); - scanf("%d", &num); - if (result = countSetBits(num)) - { - printf("\nNumber of set bits in %d: %d", num, result); - } - else - { - printf("\nThere is no set bits in %d", num); - } - return 0; -} - -int countSetBits(int num) -{ - int count = 0; - int mask= 1; - int i = 1; - while (i <= 16) - { - if (num & mask) - { - count++; - } - mask <<= 1; - i++; - } - return count; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-09.md b/docs/semester_1/assignment-primary/assignment-p-09.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-09.c' -description: 'Write a C program that includes a user-defined function named setBit with the signature int setBit(int num, int position);. The function should set the bit at the specified position (0-indexed) to 1 and return the modified number.' -source: 'semester_1/assignment-primary/assignment-p-09.c' ---- - -# assignment-p-09.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named setBit with the signature int setBit(int num, int position);. The function should set the bit at the specified position (0-indexed) to 1 and return the modified number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-09.c] -#include <stdio.h> - -int setBit(int, int); - -int main() -{ - int num, position; - printf("Enter the number: "); - scanf("%d", &num); - printf("Enter the postion where you want to set the bit (0-indexed): "); - scanf("%d", &position); - printf("\nModified number= %d", setBit(num, position)); - return 0; -} - -int setBit(int num, int position) -{ - int mask = 1 << position; - return num | mask; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-10.md b/docs/semester_1/assignment-primary/assignment-p-10.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-10.c' -description: 'Write a C program that defines a structure Rectangle with attributes length and width. Include a user-defined function named calculateArea with the signature float calculateArea(struct Rectangle r);. The function should calculate and return the area of the rectangle.' -source: 'semester_1/assignment-primary/assignment-p-10.c' ---- - -# assignment-p-10.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that defines a structure Rectangle with attributes length and width. Include a user-defined function named calculateArea with the signature float calculateArea(struct Rectangle r);. The function should calculate and return the area of the rectangle. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-10.c] -#include <stdio.h> - -struct Rectangle -{ - float length; - float width; -}; - -float calculateArea(struct Rectangle); - -int main() -{ - struct Rectangle rec; - printf("Enter the length of the Rectangle: "); - scanf("%f", &rec.length); - printf("Enter the width of the Rectangle: "); - scanf("%f", &rec.width); - printf("\nArea of the Rectangle = %g", calculateArea(rec)); -} - -float calculateArea(struct Rectangle r) -{ - return r.length * r.width; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-11.md b/docs/semester_1/assignment-primary/assignment-p-11.md @@ -1,120 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-11.c' -description: 'Write a C program that defines a structure Student containing the attributes rollNumber, name, and marks. Include a user-defined function named displayStudent with the signature void displayStudent(struct Student s);. The function should display the details of a student.' -source: 'semester_1/assignment-primary/assignment-p-11.c' ---- - -# assignment-p-11.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that defines a structure Student containing the attributes rollNumber, name, and marks. Include a user-defined function named displayStudent with the signature void displayStudent(struct Student s);. The function should display the details of a student. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-11.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct Student -{ - int rollNumber; - char name[50]; - float marks; -}; - -void inputStudent(struct Student *); -void displayStudent(struct Student); - -int main() -{ - struct Student *std = NULL; - int i, n; - - printf("How many student details you want to add : "); - if (scanf("%d", &n) != 1 || n < 1) - { - printf("\nInvalid Input."); - return 1; - } - - std = (struct Student *)malloc(n * sizeof(struct Student)); - if (std == NULL) - { - printf("\nUnable to allocate memory."); - return 1; - } - - for (i = 0; i < n; i++) - { - printf("\n- Enter details of Student %d -", i + 1); - inputStudent(&std[i]); - } - - printf("\n=== Student Details ===\n"); - for (i = 0; i < n; i++) - { - displayStudent(std[i]); - } - - free(std); - return 0; -} - -void inputStudent(struct Student *std) -{ - int len; - - printf("\nEnter the Roll Number: "); - scanf("%d", &std->rollNumber); - getchar(); - - printf("Enter the Name (Max: 50 character): "); - fgets(std->name, sizeof(std->name), stdin); - len = strlen(std->name); - if (len > 0 && std->name[len - 1] == '\n') - { - std->name[len - 1] = '\0'; - } - - printf("Enter the Marks: "); - scanf("%f", &std->marks); -} - -void displayStudent(struct Student std) -{ - printf("\n%-12s : %d", "Roll Number", std.rollNumber); - printf("\n%-12s : %s", "Name", std.name); - printf("\n%-12s : %g\n", "Marks", std.marks); -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-12_v1.md b/docs/semester_1/assignment-primary/assignment-p-12_v1.md @@ -1,90 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-12_v1.c' -description: 'Write a C program that takes multiple integers as command-line arguments and finds the maximum and minimum value among them.' -source: 'semester_1/assignment-primary/assignment-p-12_v1.c' ---- - -# assignment-p-12_v1.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that takes multiple integers as command-line arguments and finds the maximum and minimum value among them. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-12_v1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-12_v1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-12_v1.c] -#include <stdio.h> -#include <stdlib.h> - -// use atoi() - -int main(int argc, char *argv[]) -{ - int current_val, max_val, min_val, i; - char *endptr; - long first_arg_val; - if (argc < 2) - { - printf("Usage: %s <integer1> <integer2> ...\n", argv[0]); - return 1; - } - first_arg_val = strtol(argv[1], &endptr, 10); - if (*endptr != '\0' || argv[1] == endptr) - { - printf("Error: Argument '%s' is not a valid integer.\n", argv[1]); - return 1; - } - max_val = (int)first_arg_val; - min_val = (int)first_arg_val; - for (i = 2; i < argc; i++) - { - long val = strtol(argv[i], &endptr, 10); - if (*endptr != '\0' || argv[i] == endptr) - { - printf("Error: Argument '%s' is not a valid integer.\n", argv[i]); - return 1; - } - current_val = (int)val; - if (current_val > max_val) - { - max_val = current_val; - } - if (current_val < min_val) - { - min_val = current_val; - } - } - printf("The maximum value is: %d\n", max_val); - printf("The minimum value is: %d\n", min_val); - return 0; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-12_v2.md b/docs/semester_1/assignment-primary/assignment-p-12_v2.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-12_v2.c' -description: 'Write a C program that takes multiple integers as command-line arguments and finds the maximum and minimum value among them.' -source: 'semester_1/assignment-primary/assignment-p-12_v2.c' ---- - -# assignment-p-12_v2.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that takes multiple integers as command-line arguments and finds the maximum and minimum value among them. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-12_v2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-12_v2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-12_v2.c] -#include <stdio.h> -#include <stdlib.h> - -int main(int argc, char *argv[]) -{ - int current_val, max_val, min_val, i; - if (argc < 2) - { - printf("Usage: %s <integer1> <integer2> ...\n", argv[0]); - return 1; - } - max_val = atoi(argv[1]); - min_val = atoi(argv[1]); - for (i = 2; i < argc; i++) - { - current_val = atoi(argv[i]); - - if (current_val > max_val) - { - max_val = current_val; - } - if (current_val < min_val) - { - min_val = current_val; - } - } - printf("The maximum value is: %d\n", max_val); - printf("The minimum value is: %d\n", min_val); - return 0; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-13.md b/docs/semester_1/assignment-primary/assignment-p-13.md @@ -1,90 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-13.c' -description: 'Write a C program that accepts a string as a command line argument and includes a user- defined function named isPalindrome with the signature int isPalindrome(char str[]);. The function should check if the given string is a palindrome and return 1 if it is, and 0 otherwise.' -source: 'semester_1/assignment-primary/assignment-p-13.c' ---- - -# assignment-p-13.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that accepts a string as a command line argument and includes a user- defined function named isPalindrome with the signature int isPalindrome(char str[]);. The function should check if the given string is a palindrome and return 1 if it is, and 0 otherwise. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-13.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-13.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-13.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -int isPalindrome(char[]); - -int main(int argc, char *argv[]) -{ - if (argc != 2) - { - printf("\nUsage: %s <string>\n", argv[0]); - return 1; - } - if (isPalindrome(argv[1])) - { - printf("\nThe entered string \"%s\" is Palindrome.\n", argv[1]); - } - else - { - printf("\nThe entered string \"%s\" is not Palindrome.\n", argv[1]); - } - return 0; -} - -int isPalindrome(char str[]) -{ - char *start = str; - char *end; - int len = strlen(str); - if (len == 0) - { - return 1; - } - end = str + (len - 1); - while (start < end) - { - if (*start != *end) - { - return 0; - } - start++; - end--; - } - return 1; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-14_v1.md b/docs/semester_1/assignment-primary/assignment-p-14_v1.md @@ -1,99 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-14_v1.c' -description: 'Write a C program that opens its own source code file, reads its contents, and then prints the contents to the console.' -source: 'semester_1/assignment-primary/assignment-p-14_v1.c' ---- - -# assignment-p-14_v1.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that opens its own source code file, reads its contents, and then prints the contents to the console. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-14_v1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-14_v1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-14_v1.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -int main(int argc, char *argv[]) -{ - FILE *code; - int character, len_upto_dot; - char *FILENAME; - char *dot; - - FILENAME = strdup(argv[0]); - - if (FILENAME == NULL) - { - printf("\nMemory allocation failed.\n"); - return 1; - } - - dot = strrchr(FILENAME, '.'); - - if (dot != NULL) - { - len_upto_dot = dot - FILENAME; - FILENAME[len_upto_dot] = '\0'; - } - - strcat(FILENAME, ".c"); - - code = fopen(FILENAME, "r"); - - if (code == NULL) - { - printf("\nCould not open the source file: %s", FILENAME); - printf("\nPlease ensure the source file is in the same directory as the executable.\n"); - free(FILENAME); - return 1; - } - - printf("\nReading file: %s", FILENAME); - printf("\n========== %s ==========\n\n", FILENAME); - - while ((character = fgetc(code)) != EOF) - { - putchar(character); - } - - printf("\n\n========== End of %s ==========\n", FILENAME); - - fclose(code); - free(FILENAME); - - return 0; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-14_v2.md b/docs/semester_1/assignment-primary/assignment-p-14_v2.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-14_v2.c' -description: 'Write a C program that opens its own source code file, reads its contents, and then prints the contents to the console.' -source: 'semester_1/assignment-primary/assignment-p-14_v2.c' ---- - -# assignment-p-14_v2.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that opens its own source code file, reads its contents, and then prints the contents to the console. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-14_v2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-14_v2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-14_v2.c] -#include <stdio.h> - -#define FILENAME "assignment-p-14_v2.c" - -int main() -{ - FILE *code = NULL; - char temp; - - code = fopen(FILENAME, "r"); - if (code == NULL) - { - printf("\nCould not open the source file: %s", FILENAME); - return 1; - } - - printf("\nReading file: %s", FILENAME); - printf("\n========== %s ==========\n\n", FILENAME); - - while ((temp = fgetc(code)) != EOF) - { - printf("%c", temp); - } - - printf("\n\n========== End of %s ==========\n", FILENAME); - - fclose(code); - - return 0; -} -``` diff --git a/docs/semester_1/assignment-primary/assignment-p-15.md b/docs/semester_1/assignment-primary/assignment-p-15.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-p-15.c' -description: 'Write a C program that reads a sequence of integers from a file named ''input.txt''. This program should segregate the odd numbers from the even numbers and store the odd numbers in a new file named ''ODDFile.txt'' while storing the even numbers in another file named ''EVENFile.txt''' -source: 'semester_1/assignment-primary/assignment-p-15.c' ---- - -# assignment-p-15.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that reads a sequence of integers from a file named 'input.txt'. This program should segregate the odd numbers from the even numbers and store the odd numbers in a new file named 'ODDFile.txt' while storing the even numbers in another file named 'EVENFile.txt' -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-primary/assignment-p-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-primary/assignment-p-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-p-15.c] -#include <stdio.h> - -#define FILENAME "input.txt" -#define ODDFILE "ODDFile.txt" -#define EVENFILE "EVENFile.txt" - -int main() -{ - FILE *input = NULL; - FILE *oddfile = NULL; - FILE *evenfile = NULL; - int num; - - input = fopen(FILENAME, "r"); - if (input == NULL) - { - printf("\nCould not open the file: %s", FILENAME); - return 1; - } - - oddfile = fopen(ODDFILE, "w"); - if (oddfile == NULL) - { - printf("\nCould not open the file: %s", ODDFILE); - return 1; - } - - evenfile = fopen(EVENFILE, "w"); - if (evenfile == NULL) - { - printf("\nCould not open the file: %s", EVENFILE); - return 1; - } - - while (fscanf(input, "%d", &num) == 1) - { - if (num % 2 == 0) - { - fprintf(evenfile, "%d ", num); - } - else - { - fprintf(oddfile, "%d ", num); - } - } - - printf("Successfully processed numbers from %s.\n", FILENAME); - printf("Odd numbers written to %s.\n", ODDFILE); - printf("Even numbers written to %s.\n", EVENFILE); - - fclose(input); - fclose(oddfile); - fclose(evenfile); - - return 0; -} -``` diff --git a/docs/semester_1/assignment-primary/index.md b/docs/semester_1/assignment-primary/index.md @@ -1,26 +0,0 @@ -# Assignment Primary - -Files and sub-folders in **Assignment Primary**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `assignment-p-01.c` | [View Code](assignment-p-01.md) | -| 2 | `assignment-p-02.c` | [View Code](assignment-p-02.md) | -| 3 | `assignment-p-03.c` | [View Code](assignment-p-03.md) | -| 4 | `assignment-p-04.c` | [View Code](assignment-p-04.md) | -| 5 | `assignment-p-05.c` | [View Code](assignment-p-05.md) | -| 6 | `assignment-p-06.c` | [View Code](assignment-p-06.md) | -| 7 | `assignment-p-07.c` | [View Code](assignment-p-07.md) | -| 8 | `assignment-p-08.c` | [View Code](assignment-p-08.md) | -| 9 | `assignment-p-09.c` | [View Code](assignment-p-09.md) | -| 10 | `assignment-p-10.c` | [View Code](assignment-p-10.md) | -| 11 | `assignment-p-11.c` | [View Code](assignment-p-11.md) | -| 12 | `assignment-p-12_v1.c` | [View Code](assignment-p-12_v1.md) | -| 13 | `assignment-p-12_v2.c` | [View Code](assignment-p-12_v2.md) | -| 14 | `assignment-p-13.c` | [View Code](assignment-p-13.md) | -| 15 | `assignment-p-14_v1.c` | [View Code](assignment-p-14_v1.md) | -| 16 | `assignment-p-14_v2.c` | [View Code](assignment-p-14_v2.md) | -| 17 | `assignment-p-15.c` | [View Code](assignment-p-15.md) | - diff --git a/docs/semester_1/assignment-secondary/assignment-s-01.md b/docs/semester_1/assignment-secondary/assignment-s-01.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-01.c' -description: 'Write a program to compute the sum and product of digits of an integer using user defined functions.' -source: 'semester_1/assignment-secondary/assignment-s-01.c' ---- - -# assignment-s-01.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to compute the sum and product of digits of an integer using user defined functions. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-01.c] -#include <stdio.h> - -int sum_of_digits(int); -int product_of_digits(int); - -int main() -{ - int num; - printf("Enter the number: "); - scanf("%d", &num); - printf("\nSum of digits of %d = %d", num, sum_of_digits(num)); - printf("\nProduct of digits of %d = %d", num, product_of_digits(num)); - return 0; -} - -int sum_of_digits(int num) -{ - int sum = 0; - while (num > 0) - { - sum += num % 10; - num /= 10; - } - return sum; -} - -int product_of_digits(int num) -{ - int product = 1; - while (num > 0) - { - product *= num % 10; - num /= 10; - } - return product; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-02.md b/docs/semester_1/assignment-secondary/assignment-s-02.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-02.c' -description: 'Write a program to reverse a non-negative integer using a function.' -source: 'semester_1/assignment-secondary/assignment-s-02.c' ---- - -# assignment-s-02.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to reverse a non-negative integer using a function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-02.c] -#include <stdio.h> - -int reverse(int); - -int main() -{ - int num; - printf("Enter a non-negetive integer: "); - scanf("%d", &num); - if (num < 0) - { - printf("\nOnly non-negetive integers are allowed."); - return 1; - } - printf("\nReverse of the integer %d = %d", num, reverse(num)); - return 0; -} - -int reverse(int num) -{ - int rev = 0; - while (num > 0) - { - rev = (rev * 10) + (num % 10); - num /= 10; - } - return rev; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-03.md b/docs/semester_1/assignment-secondary/assignment-s-03.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-03.c' -description: 'Write a program to compute the sum of the first n terms of the series using a function: S=1−2+3−4+5−6+…' -source: 'semester_1/assignment-secondary/assignment-s-03.c' ---- - -# assignment-s-03.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to compute the sum of the first n terms of the series using a function: S=1−2+3−4+5−6+… -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-03.c] -#include <stdio.h> - -int sum_of_series(int); - -int main() -{ - int n; - printf("Enter the n: "); - scanf("%d", &n); - printf("\nSum of the first %d terms of the series = %d", n, sum_of_series(n)); - return 0; -} - -int sum_of_series(int n) -{ - int sum = 0; - int i; - for (i = 1; i <= n; i++) - { - if (i % 2 == 0) - { - sum -= i; - } - else - { - sum += i; - } - } - return sum; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-04.md b/docs/semester_1/assignment-secondary/assignment-s-04.md @@ -1,94 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-04.c' -description: 'Write a function to check whether a number is prime or not. Use the same function to generate all prime numbers less than 100.' -source: 'semester_1/assignment-secondary/assignment-s-04.c' ---- - -# assignment-s-04.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function to check whether a number is prime or not. Use the same function to generate all prime numbers less than 100. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-04.c] -#include <stdio.h> -#include <math.h> - -int isPrime(int); - -int main() -{ - int n, i; - printf("Enter the number: "); - scanf("%d", &n); - if (isPrime(n)) - { - printf("\nInput %d is a Prime Number.", n); - } - else - { - printf("\nInput %d is not a Prime Number.", n); - } - printf("\nPrime Numbers less than 100:"); - for (i = 1; i < 100; i++) - { - if (isPrime(i)) - { - printf(" %d", i); - } - } - return 0; -} - -int isPrime(int n) -{ - if (n <= 1) - return 0; - if (n == 2) - return 1; - if (n % 2 == 0) - return 0; - - int temp = (int)sqrt(n); - int i; - for (i = 3; i <= temp; i += 2) - { - if (n % i == 0) - { - return 0; - } - } - return 1; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-05.md b/docs/semester_1/assignment-secondary/assignment-s-05.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-05.c' -description: 'Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome.' -source: 'semester_1/assignment-secondary/assignment-s-05.c' ---- - -# assignment-s-05.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-05.c] -#include <stdio.h> -#include <string.h> - -int isPalindrome(char[]); - -int main() -{ - char input[100]; - int len; - - printf("Enter the string (Max: 100 Character): "); - fgets(input, sizeof(input), stdin); - len = strlen(input); - - if (len > 0 && input[len - 1] == '\n') - { - input[len - 1] = '\0'; - } - - if (isPalindrome(input)) - { - printf("\nInput string \"%s\" is Palindrome.", input); - } - else - { - printf("\nInput string \"%s\" is not Palindrome", input); - } - - return 0; -} - -int isPalindrome(char str[]) -{ - char *start = str; - char *end; - int len = strlen(str); - - if (len == 0) - { - return 1; - } - - end = str + (len - 1); - - while (start < end) - { - if (*start != *end) - { - return 0; - } - start++; - end--; - } - - return 1; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-06.md b/docs/semester_1/assignment-secondary/assignment-s-06.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-06.c' -description: 'Write a program using a function to compute and display all factors of a given number.' -source: 'semester_1/assignment-secondary/assignment-s-06.c' ---- - -# assignment-s-06.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using a function to compute and display all factors of a given number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-06.c] -#include <stdio.h> -#include <stdlib.h> - -void display_factors(int); - -int main() -{ - int num, i; - printf("Please enter the number to get the factors from it : "); - scanf("%d", &num); - display_factors(num); - return 0; -} - -void display_factors(int num) { - int temp = abs(num); - int i; - - if (temp == 0) - { - printf("\n0 has infinitely many factors (all integers)."); - exit(1); - } - - printf("\nThe factors of ' %d ' is :- ", num); - printf("\nPositive : "); - for (i = 1; i <= temp; i++) - if (temp % i == 0) - printf(" %d", i); - printf("\nNegative : "); - for (i = 1; i <= temp; i++) - if (temp % i == 0) - printf(" %d", -i); -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-07.md b/docs/semester_1/assignment-secondary/assignment-s-07.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-07.c' -description: 'Write a program to swap two numbers using a macro (#define).' -source: 'semester_1/assignment-secondary/assignment-s-07.c' ---- - -# assignment-s-07.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to swap two numbers using a macro (#define). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-07.c] -#include <stdio.h> - -// Define the SWAP macro. -// The do-while(0) block is a common trick to ensure the macro behaves -// like a single statement, regardless of where it is used (e.g., inside an 'if' statement). -#define SWAP(a, b, data_type) \ - do { \ - data_type temp = a; \ - a = b; \ - b = temp; \ - } while(0) - -int main() { - int num1 = 15; - int num2 = 42; - - printf("--- Before Swap ---\n"); - printf("Number 1 (num1): %d\n", num1); - printf("Number 2 (num2): %d\n", num2); - - // Call the macro, passing the variables and their type - // The preprocessor replaces this line with the block of code defined above. - SWAP(num1, num2, int); - - printf("\n--- After Swap (using macro) ---\n"); - printf("Number 1 (num1): %d\n", num1); - printf("Number 2 (num2): %d\n", num2); - - return 0; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-08.md b/docs/semester_1/assignment-secondary/assignment-s-08.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-08.c' -description: 'Write a program that counts the number of occurrences of each alphabet (A-Z, a-z) in the text entered using Command-Line Arguments.' -source: 'semester_1/assignment-secondary/assignment-s-08.c' ---- - -# assignment-s-08.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that counts the number of occurrences of each alphabet (A-Z, a-z) in the text entered using Command-Line Arguments. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-08.c] -#include <stdio.h> -#include <string.h> - -int main(int argc, char *argv[]) -{ - int target[2], i, j, count[2], len; - for (target[0] = 'A', target[1] = 'a'; target[0] <= 'Z', target[1] <= 'z'; target[0]++, target[1]++) - { - count[0] = 0; - count[1] = 0; - for (i = 1; i < argc; i++) - { - len = strlen(argv[i]); - for (j = 0; j < len; j++) - { - if (argv[i][j] == target[0]) - { - count[0]++; - } - if (argv[i][j] == target[1]) - { - count[1]++; - } - } - } - if (count[0]) - { - printf("\n\"%c\" found %d times.", target[0], count[0]); - } - if (count[1]) - { - printf("\n\"%c\" found %d times.", target[1], count[1]); - } - } - return 0; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-09.md b/docs/semester_1/assignment-secondary/assignment-s-09.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-09.c' -description: 'Write a program to swap two numbers using pointers (user-defined function).' -source: 'semester_1/assignment-secondary/assignment-s-09.c' ---- - -# assignment-s-09.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 17 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to swap two numbers using pointers (user-defined function). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-09.c] -#include <stdio.h> - -void swap(int *, int *); - -int main() -{ - int a, b; - printf("Enter value for a and b: "); - scanf("%d %d", &a, &b); - printf("\nBefore Swap: "); - printf("\na = %d,\tAddress: %u", a, &a); - printf("\nb = %d,\tAddress: %u", b, &b); - swap(&a, &b); - printf("\nAfter Swap: "); - printf("\na = %d,\tAddress: %u", a, &a); - printf("\nb = %d,\tAddress: %u", b, &b); - return 0; -} - -void swap(int *a, int *b) -{ - *a = *a ^ *b; - *b = *a ^ *b; - *a = *a ^ *b; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-10.md b/docs/semester_1/assignment-secondary/assignment-s-10.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-10.c' -description: 'Write a program to swap two numbers using pointers (user-defined function).' -source: 'semester_1/assignment-secondary/assignment-s-10.c' ---- - -# assignment-s-10.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 17 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to swap two numbers using pointers (user-defined function). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-10.c] -#include <stdio.h> - -void swap(int *, int *); - -int main() -{ - int a, b; - printf("Enter value for a and b: "); - scanf("%d %d", &a, &b); - printf("\nBefore Swap: "); - printf("\na = %d,\tAddress: %u", a, &a); - printf("\nb = %d,\tAddress: %u", b, &b); - swap(&a, &b); - printf("\nAfter Swap: "); - printf("\na = %d,\tAddress: %u", a, &a); - printf("\nb = %d,\tAddress: %u", b, &b); - return 0; -} - -void swap(int *a, int *b) -{ - *a = *a ^ *b; - *b = *a ^ *b; - *a = *a ^ *b; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-11.md b/docs/semester_1/assignment-secondary/assignment-s-11.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-11.c' -description: 'Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main().' -source: 'semester_1/assignment-secondary/assignment-s-11.c' ---- - -# assignment-s-11.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 17 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main(). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-11.c] -#include <stdio.h> -#include <math.h> - -void area_circumference(double, double *, double *); - -int main() -{ - double r, area, circumference; - printf("Enter the radius of the circle: "); - scanf("%lf", &r); - area_circumference(r, &area, &circumference); - printf("\nArea of the circle = %g", area); - printf("\nCircumference of the circle = %g", circumference); - return 0; -} - -void area_circumference(double r, double *area, double *circumference) -{ - *area = M_PI * r * r; - *circumference = 2 * M_PI * r; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-12.md b/docs/semester_1/assignment-secondary/assignment-s-12.md @@ -1,82 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-12.c' -description: 'Write a program to find the sum of n elements entered by the user. Use dynamic memory allocation (malloc() or calloc()).' -source: 'semester_1/assignment-secondary/assignment-s-12.c' ---- - -# assignment-s-12.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 17 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the sum of n elements entered by the user. Use dynamic memory allocation (malloc() or calloc()). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-12.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-12.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-12.c] -#include <stdio.h> -#include <stdlib.h> - -void inputarr(int[], int); -int sum_elem(int[], int); - -int main() -{ - int n, *arr; - printf("How many element do you want to enter: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - inputarr(arr, n); - printf("\nSum of the %d element(s) = %d", n, sum_elem(arr, n)); - free(arr); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int sum_elem(int arr[], int n) -{ - int i, sum = 0; - for (i = 0; i < n; i++) - { - sum += arr[i]; - } - return sum; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-13-1.md b/docs/semester_1/assignment-secondary/assignment-s-13-1.md @@ -1,102 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-13-1.c' -description: 'Write a function that reverses the elements of an array in place, using only a single pointer argument, and return void.' -source: 'semester_1/assignment-secondary/assignment-s-13-1.c' ---- - -# assignment-s-13-1.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 19 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function that reverses the elements of an array in place, using only a single pointer argument, and return void. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-13-1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-13-1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-13-1.c] -#include <stdio.h> -#include <stdlib.h> - -void inputarr(int[], int); -void display(int[], int); -void reverse(int *); - -int main() -{ - int size, *arr; - printf("How many element do you want to add: "); - scanf("%d", &size); - arr = (int *)malloc((size + 1) * sizeof(int)); - inputarr(arr, size); - printf("\n=== Before Reverse ===\n"); - display(arr, size); - reverse(arr); - printf("\n\n=== After Reverse ===\n"); - display(arr, size); - free(arr); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - arr[0] = n; - for (i = 1; i <= n; i++) - { - printf("Enter element %d: ", i); - scanf("%d", &arr[i]); - } -} - -void display(int arr[], int n) -{ - int i; - for (i = 1; i <= n; i++) - { - printf("\nIndex: %-2d | Value: %-5d | Address: %p", i, arr[i], (void *)&arr[i]); - } -} - -void reverse(int *arr) -{ - int *start = arr + 1; - int size = *arr; - int *end = arr + size; - while (start < end) - { - *start = *start ^ *end; - *end = *start ^ *end; - *start = *start ^ *end; - start++; - end--; - } -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-13-2.md b/docs/semester_1/assignment-secondary/assignment-s-13-2.md @@ -1,106 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-13-2.c' -description: 'Write a function that reverses the elements of an array in place, using only a single pointer argument, and return void.' -source: 'semester_1/assignment-secondary/assignment-s-13-2.c' ---- - -# assignment-s-13-2.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 19 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function that reverses the elements of an array in place, using only a single pointer argument, and return void. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-13-2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-13-2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-13-2.c] -#include <stdio.h> -#include <stdlib.h> - -struct Array -{ - int size; - int *arr; -}; - -void inputarr(int[], int); -void display(int[], int); -void reverse(struct Array *); - -int main() -{ - struct Array array; - printf("How many element do you want to add: "); - scanf("%d", &array.size); - array.arr = (int *)malloc((array.size) * sizeof(int)); - inputarr(array.arr, array.size); - printf("\n=== Before Reverse ===\n"); - display(array.arr, array.size); - reverse(&array); - printf("\n\n=== After Reverse ===\n"); - display(array.arr, array.size); - free(array.arr); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void display(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("\nIndex: %-2d | Value: %-5d | Address: %p", i, arr[i], (void *)&arr[i]); - } -} - -void reverse(struct Array *array) -{ - int *start = array->arr; - int *end = array->arr + (array->size - 1); - while (start < end) - { - *start = *start ^ *end; - *end = *start ^ *end; - *start = *start ^ *end; - start++; - end--; - } -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-14.md b/docs/semester_1/assignment-secondary/assignment-s-14.md @@ -1,308 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-14.c' -description: 'Write a menu-driven program to perform the following string operations: a. Show address of each character b. Concatenate two strings without using strcat() c. Concatenate two strings using strcat() d. Compare two strings e. Find string length using pointers f. Convert lowercase to uppercase g. Convert uppercase to lowercase h. Count number of vowels i. Reverse the string' -source: 'semester_1/assignment-secondary/assignment-s-14.c' ---- - -# assignment-s-14.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 20 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a menu-driven program to perform the following string operations: a. Show address of each character b. Concatenate two strings without using strcat() c. Concatenate two strings using strcat() d. Compare two strings e. Find string length using pointers f. Convert lowercase to uppercase g. Convert uppercase to lowercase h. Count number of vowels i. Reverse the string -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-14.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-14.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-14.c] -#include <stdio.h> -#include <ctype.h> -#include <string.h> - -void address_char(char *); -void concat_manual(char[], char[]); -void concat_strcat(char[], char[]); -int string_cmp(char *, char *); -int string_len(char *); -void ltou(char[]); -void utol(char[]); -int vowel_count(char[]); -void reverse(char[]); - -int main() -{ - char str1[100], str2[100], choice; - int result_cmp; - - printf("Enter first string (Max: 100 character): "); - fgets(str1, sizeof(str1), stdin); - str1[strcspn(str1, "\n")] = '\0'; - // this will replace the enter (\n) used in the end to null - - printf("Enter second string (Max: 100 character): "); - fgets(str2, sizeof(str2), stdin); - str2[strcspn(str2, "\n")] = '\0'; - - while (1) - { - printf("\n\n\n ========== MENU ==========\n" - "a. Show address of each character\n" - "b. Concatenate two strings without using strcat()\n" - "c. Concatenate two strings using strcat()\n" - "d. Compare two strings\n" - "e. Find string length using pointers\n" - "f. Convert lowercase to uppercase\n" - "g. Convert uppercase to lowercase\n" - "h. Count number of vowels\n" - "i. Reverse the string\n" - "1. Change input strings\n" - "0. Exit\n"); - printf("\nEnter your choice: "); - scanf(" %c", &choice); - choice = tolower(choice); - - switch (choice) - { - case '1': - while (getchar() != '\n') - ; - printf("Enter first string (Max: 100 character): "); - fgets(str1, sizeof(str1), stdin); - str1[strcspn(str1, "\n")] = '\0'; - - printf("Enter second string (Max: 100 character): "); - fgets(str2, sizeof(str2), stdin); - str2[strcspn(str2, "\n")] = '\0'; - - break; - case '0': - printf("\n\n\nExiting program...\n\n"); - return 0; - - case 'a': - printf("\n --- Show address of each character ---\n"); - printf("\nSrting 1: "); - address_char(str1); - printf("\nString 2: "); - address_char(str2); - break; - case 'b': - printf("\n --- Concatenate two strings without using strcat() ---\n"); - printf("\nResult: "); - concat_manual(str1, str2); - break; - case 'c': - printf("\n --- Concatenate two strings using strcat() ---\n"); - printf("\nResult: "); - concat_strcat(str1, str2); - break; - case 'd': - printf("\n --- Compare two strings ---\n"); - result_cmp = string_cmp(str1, str2); - if (result_cmp == 0) - { - printf("\nString 1 = String 2"); - break; - } - else if (result_cmp > 0) - { - printf("\nString 1 > String 2"); - break; - } - else - { - printf("\nString 1 < String 2"); - break; - } - case 'e': - printf("\n --- Find string length using pointers ---\n"); - printf("\nLength of the String_1: %d", string_len(str1)); - printf("\nLength of the String_2: %d", string_len(str2)); - break; - case 'f': - printf("\n --- Convert lowercase to uppercase ---\n"); - printf("\nString 1: "); - ltou(str1); - printf("\nString 2: "); - ltou(str2); - break; - case 'g': - printf("\n --- Convert uppercase to lowercase ---\n"); - printf("\nString 1: "); - utol(str1); - printf("\nString 2: "); - utol(str2); - break; - case 'h': - printf("\n --- Count number of vowels ---\n"); - printf("\nString 1: %d", vowel_count(str1)); - printf("\nString 2: %d", vowel_count(str2)); - break; - case 'i': - printf("\n --- Reverse the string ---\n"); - printf("\nString 1: "); - reverse(str1); - printf("\nString 2: "); - reverse(str2); - break; - default: - printf("\nWrong choice. Try again...\n"); - } - } -} - -void address_char(char *str) -{ - printf("\nCharacter | Memory Address"); - printf("\n--------- | --------------"); - - while (*str != '\0') - { - printf("\n %-6c| %p", *str, (void *)str); - str++; - } -} - -void concat_manual(char str1[], char str2[]) -{ - int size1 = strlen(str1); - int size2 = strlen(str2); - char result[size1 + size2 + 1]; - int i = 0, j; - - j = 0; - while (str1[j] != '\0') - { - result[i] = str1[j]; - i++; - j++; - } - - j = 0; - while (str2[j] != '\0') - { - result[i] = str2[j]; - i++; - j++; - } - - result[i] = '\0'; - printf("%s\n", result); -} - -void concat_strcat(char str1[], char str2[]) -{ - int size1 = strlen(str1); - int size2 = strlen(str2); - char result[size1 + size2 + 1]; - - result[0] = '\0'; - strcat(result, str1); - strcat(result, str2); - - printf("%s\n", result); -} - -int string_cmp(char *str1, char *str2) -{ - // written based on strcmp() - while (*str1 != '\0' && (*str1 == *str2)) - { - str1++; - str2++; - } - return (*str1 - *str2); -} - -int string_len(char *str) -{ - char *end = str; - while (*end != '\0') - { - end++; - } - return end - str; -} - -void ltou(char str[]) -{ - int i; - for (i = 0; str[i] != '\0'; i++) - { - printf("%c", toupper(str[i])); - } -} - -void utol(char str[]) -{ - int i; - for (i = 0; str[i] != '\0'; i++) - { - printf("%c", tolower(str[i])); - } -} - -int vowel_count(char str[]) -{ - int i, vowel = 0; - char character; - for (i = 0; str[i] != '\0'; i++) - { - character = tolower(str[i]); - if (character == 'a' || character == 'e' || character == 'i' || character == 'o' || character == 'u') - { - vowel++; - } - } - return vowel; -} - -void reverse(char str[]) -{ - int len = strlen(str); - char result[len + 1]; - char *start = result; - char *end = result + len - 1; - char temp; - - result[0] = '\0'; - strcat(result, str); - - while (start < end) - { - temp = *start; - *start = *end; - *end = temp; - start++; - end--; - } - printf("%s\n", result); -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-15.md b/docs/semester_1/assignment-secondary/assignment-s-15.md @@ -1,92 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-15.c' -description: 'Write a program to merge two sorted integer arrays to form a single sorted array.' -source: 'semester_1/assignment-secondary/assignment-s-15.c' ---- - -# assignment-s-15.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 21 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to merge two sorted integer arrays to form a single sorted array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-15.c] -#include <stdio.h> -#include <stdlib.h> - -void merge(int[], int, int[], int); - -int main() -{ - int a[] = {10, 30, 50, 70, 90}; - int b[] = {20, 40, 60, 80, 100}; - int n1 = sizeof(a) / sizeof(a[0]); - int n2 = sizeof(b) / sizeof(b[0]); - merge(a, n1, b, n2); - return 0; -} - -void merge(int a[], int n1, int b[], int n2) -{ - int n = n1 + n2; - int *c = (int *)malloc(n * sizeof(int)); - int i, j, k; - i = j = k = 0; - while (i < n1 && j < n2) - { - if (a[i] < b[j]) - { - c[k++] = a[i++]; - } - else - { - c[k++] = b[j++]; - } - } - while (i < n1) - { - c[k++] = a[i++]; - } - while (j < n2) - { - c[k++] = b[j++]; - } - printf("Merged Array:"); - for (i = 0; i < n; i++) - { - printf(" %d", c[i]); - } - free(c); -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-16.md b/docs/semester_1/assignment-secondary/assignment-s-16.md @@ -1,111 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-16.c' -description: 'Write a program that reads 10 integers into an array (using pointers), and prints the array in ascending and descending order.' -source: 'semester_1/assignment-secondary/assignment-s-16.c' ---- - -# assignment-s-16.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 21 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that reads 10 integers into an array (using pointers), and prints the array in ascending and descending order. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-16.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-16.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-16.c] -#include <stdio.h> -#include <stdlib.h> - -#define true 1 -#define false 0 - -void input_arr(int *, int); -void print(int *, int); - -int main() -{ - int arr[10]; - input_arr(arr, 10); - print(arr, 10); - return 0; -} - -void input_arr(int *arr, int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", arr + i); - } -} - -void print(int *arr, int n) -{ - int i, j, isSwaped = true, backup; - int *temp = (int *)malloc(n * sizeof(int)); - if (temp == NULL) - { - printf("\nMemory Allocation Failed."); - return; - } - for (i = 0; i < n; i++) - { - *(temp + i) = *(arr + i); - } - for (i = 0; i < n - 1 && isSwaped == true; i++) - { - isSwaped = false; - for (j = 0; j < n - i - 1; j++) - { - if (*(temp + j) > *(temp + j + 1)) - { - backup = *(temp + j); - *(temp + j) = *(temp + j + 1); - *(temp + j + 1) = backup; - isSwaped = true; - } - } - } - printf("\nAscending Order:"); - for (i = 0; i < n; i++) - { - printf(" %d", *(temp + i)); - } - printf("\nDescending Order:"); - for (i = n - 1; i >= 0; i--) - { - printf(" %d", *(temp + i)); - } - free(temp); -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-17.md b/docs/semester_1/assignment-secondary/assignment-s-17.md @@ -1,126 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-17.c' -description: 'Write a program to display the Fibonacci series (i) using recursion (ii) using iteration' -source: 'semester_1/assignment-secondary/assignment-s-17.c' ---- - -# assignment-s-17.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 21 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to display the Fibonacci series (i) using recursion (ii) using iteration -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-17.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-17.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-17.c] -#include <stdio.h> - -long long int fib_rec(int); -long long int fib_tail_rec(int, long long int, long long int); -void fib_rec_print(int); -void fib_ite_print(int); - -int main() -{ - int n; - printf("Enter the number of terms: "); - scanf("%d", &n); - fib_rec_print(n); - fib_ite_print(n); - return 0; -} - -long long int fib_rec(int n) -{ - if (n == 0 || n == 1) - { - return n; - } - else - { - return fib_rec(n - 1) + fib_rec(n - 2); - } -} - -long long int fib_tail_rec(int n, long long int t1, long long int t2) -{ - if (n == 0) - { - return t1; - } - else if (n == 1) - { - return t2; - } - else - { - return fib_tail_rec(n - 1, t2, t1 + t2); - } -} - -void fib_rec_print(int n) -{ - int i; - printf("\nFibonacci Series (Recursion):"); - for (i = 0; i < n; i++) - { - printf(" %lld", fib_rec(i)); - } - printf("\nFibonacci Series (Tail-Recursion):"); - for (i = 0; i < n; i++) - { - printf(" %lld", fib_tail_rec(i, 0, 1)); - } -} - -void fib_ite_print(int n) -{ - int i; - long long int t1 = 0, t2 = 1, temp; - printf("\nFibonacci Series (Iteration):"); - if (n > 0) - { - printf(" 0"); - } - if (n > 1) - { - printf(" 1"); - } - for (i = 2; i < n; i++) - { - printf(" %lld", t1 + t2); - temp = t1; - t1 = t2; - t2 = temp + t2; - } -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-18.md b/docs/semester_1/assignment-secondary/assignment-s-18.md @@ -1,105 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-18.c' -description: 'Write a program to calculate the factorial of a number (i) using recursion (ii) using iteration' -source: 'semester_1/assignment-secondary/assignment-s-18.c' ---- - -# assignment-s-18.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 22 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate the factorial of a number (i) using recursion (ii) using iteration -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-18.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-18.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-18.c] -#include <stdio.h> - -long long int fact_tail_rec(int, long long int); -long long int fact_rec(int); -long long int fact_ite(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - if (n < 0) - { - printf("\nFactorial of negetive number is not possible."); - return 1; - } - printf("\nFactorial of %d (Tail-Recursion) = %lld", n, fact_tail_rec(n, 1)); - printf("\nFactorial of %d (Recursion) = %lld", n, fact_rec(n)); - printf("\nFactorial of %d (Iteration) = %lld", n, fact_ite(n)); - return 0; -} - -long long int fact_tail_rec(int n, long long int result) -{ - if (n == 0 || n == 1) - { - return result; - } - else - { - return fact_tail_rec(n - 1, n * result); - } -} - -long long int fact_rec(int n) -{ - if (n == 0 || n == 1) - { - return 1; - } - else - { - return n * fact_rec(n - 1); - } -} - -long long int fact_ite(int n) -{ - int i; - long long int result = 1; - if (n == 0 || n == 1) - { - return 1; - } - for (i = 2; i <= n; i++) - { - result *= i; - } - return result; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-19.md b/docs/semester_1/assignment-secondary/assignment-s-19.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-19.c' -description: 'Write a program to calculate the GCD of two numbers (i) using recursion (ii) without recursion' -source: 'semester_1/assignment-secondary/assignment-s-19.c' ---- - -# assignment-s-19.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 22 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate the GCD of two numbers (i) using recursion (ii) without recursion -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-19.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-19.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-19.c] -#include <stdio.h> - -int gcd_tail_rec(int, int); -int gcd_rec(int, int); -int gcd_ite(int, int); - -int main() -{ - int a, b; - printf("Enter two number: "); - scanf("%d %d", &a, &b); - if (a < 0) - a = -a; - if (b < 0) - b = -b; - printf("\nGCD (Tail-Recursion) of %d and %d is = %d", a, b, gcd_tail_rec(a, b)); - printf("\nGCD (Recursion) of %d and %d is = %d", a, b, gcd_rec(a, b)); - printf("\nGCD (Iteration) of %d and %d is = %d", a, b, gcd_ite(a, b)); - return 0; -} - -int gcd_tail_rec(int a, int b) -{ - if (b == 0) - { - return a; - } - else - { - return gcd_tail_rec(b, a % b); - } -} - -int gcd_rec(int a, int b) -{ - if (b == 0) - { - return a; - } - else - { - return gcd_rec(b, a % b); - } -} - -int gcd_ite(int a, int b) -{ - int temp; - while (b > 0) - { - temp = b; - b = a % b; - a = temp; - } - return a; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-20.md b/docs/semester_1/assignment-secondary/assignment-s-20.md @@ -1,356 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-20.c' -description: 'Write a menu-driven program to perform the following matrix operations using 2-D arrays and functions: a. Sum b. Difference c. Product d. Transpose' -source: 'semester_1/assignment-secondary/assignment-s-20.c' ---- - -# assignment-s-20.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 22 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a menu-driven program to perform the following matrix operations using 2-D arrays and functions: a. Sum b. Difference c. Product d. Transpose -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-20.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-20.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-20.c] -#include <stdio.h> -#include <stdlib.h> - -#define COL_MAX 10 -#define COL_MIN 0 -#define ROW_MAX 10 -#define ROW_MIN 0 -#define TRUE 1 -#define FALSE 0 - -void input(int ***, int *, int *); -void display(int **, int, int); -void clear(int **, int); -void sum(int **, int **, int, int); -void difference(int **, int **, int, int); -void product(int **, int **, int, int, int); -void transpose(int **, int, int); - -int main() -{ - int **a = NULL, **b = NULL; - int rows_a, rows_b, cols_a, cols_b; - int choice; - - while (TRUE) - { - printf("\n === MENU ===\n" - "1. Sum\n" - "2. Difference\n" - "3. Product\n" - "4. Transpose\n" - "0. Exit\n"); - printf("\nEnter your choice: "); - scanf("%d", &choice); - - switch (choice) - { - case 1: - input(&a, &rows_a, &cols_a); - if (a == NULL) - break; - - input(&b, &rows_b, &cols_b); - if (b == NULL) - { - clear(a, rows_a); - a = NULL; - break; - } - - printf("\nMatrix A = \n"); - display(a, rows_a, cols_a); - printf("\nMatrix B = \n"); - display(b, rows_b, cols_b); - - if (rows_a != rows_b || cols_a != cols_b) - { - printf("\nOrder of both matrix should be same to calculate sum."); - printf("\nInput : Matrix A = [%d x %d]" - " Matrix B = [%d x %d]", - rows_a, cols_a, rows_b, cols_b); - - clear(a, rows_a); - clear(b, rows_b); - a = NULL; - b = NULL; - break; - } - printf("\nResult = \n"); - sum(a, b, rows_a, cols_a); - - clear(a, rows_a); - clear(b, rows_b); - a = NULL; - b = NULL; - - break; - - case 2: - input(&a, &rows_a, &cols_a); - if (a == NULL) - break; - - input(&b, &rows_b, &cols_b); - if (b == NULL) - { - clear(a, rows_a); - a = NULL; - break; - } - - printf("\nMatrix A = \n"); - display(a, rows_a, cols_a); - printf("\nMatrix B = \n"); - display(b, rows_b, cols_b); - - if (rows_a != rows_b || cols_a != cols_b) - { - printf("\nOrder of both matrix should be same to calculate difference."); - printf("\nInput : Matrix A = [%d x %d]" - " Matrix B = [%d x %d]", - rows_a, cols_a, rows_b, cols_b); - - clear(a, rows_a); - clear(b, rows_b); - a = NULL; - b = NULL; - break; - } - printf("\nResult = \n"); - difference(a, b, rows_a, cols_a); - - clear(a, rows_a); - clear(b, rows_b); - a = NULL; - b = NULL; - - break; - - case 3: - input(&a, &rows_a, &cols_a); - if (a == NULL) - break; - - input(&b, &rows_b, &cols_b); - if (b == NULL) - { - clear(a, rows_a); - a = NULL; - break; - } - - printf("\nMatrix A = \n"); - display(a, rows_a, cols_a); - printf("\nMatrix B = \n"); - display(b, rows_b, cols_b); - - if (cols_a != rows_b) - { - printf("\nColumn count of matrix A should be same as Row count of matrix B."); - printf("\nInput : Matrix A = [%d x %d]" - " Matrix B = [%d x %d]", - rows_a, cols_a, rows_b, cols_b); - - clear(a, rows_a); - clear(b, rows_b); - a = NULL; - b = NULL; - break; - } - printf("\nResult = \n"); - product(a, b, rows_a, cols_b, cols_a); - - clear(a, rows_a); - clear(b, rows_b); - a = NULL; - b = NULL; - - break; - - case 4: - input(&a, &rows_a, &cols_a); - if (a == NULL) - break; - - printf("\nMatrix = \n"); - display(a, rows_a, cols_a); - - printf("\nResult = \n"); - transpose(a, rows_a, cols_a); - - clear(a, rows_a); - a = NULL; - - break; - - case 0: - printf("\n\nExiting program...\n"); - return 0; - - default: - printf("\nInvalid choice. Please pick a choice from the menu.\n"); - } - } -} - -void input(int ***matrix, int *rows, int *cols) -{ - int i, j; - printf("\nEnter row and column count (Max : 10 x 10): "); - scanf("%d %d", rows, cols); - - if (*rows > ROW_MAX || *cols > COL_MAX || *rows <= ROW_MIN || *cols <= COL_MIN) - { - printf("\nInvalid dimensions. Limit is 1 to 10.\n"); - *matrix = NULL; - return; - } - - *matrix = (int **)malloc(*rows * sizeof(int *)); - - for (i = 0; i < *rows; i++) - { - (*matrix)[i] = (int *)malloc(*cols * sizeof(int)); - for (j = 0; j < *cols; j++) - { - printf("Enter element [%d][%d]: ", i + 1, j + 1); - scanf("%d", &((*matrix)[i][j])); - } - } -} - -void display(int **matrix, int rows, int cols) -{ - int i, j; - for (i = 0; i < rows; i++) - { - for (j = 0; j < cols; j++) - { - printf("%d ", matrix[i][j]); - } - printf("\n"); - } -} - -void clear(int **matrix, int rows) -{ - int i; - for (i = 0; i < rows; i++) - { - free(matrix[i]); - } - free(matrix); -} - -void sum(int **a, int **b, int rows, int cols) -{ - int i, j; - - int **r = (int **)malloc(rows * sizeof(int *)); - for (i = 0; i < rows; i++) - { - r[i] = (int *)malloc(cols * sizeof(int)); - for (j = 0; j < cols; j++) - { - r[i][j] = a[i][j] + b[i][j]; - } - } - display(r, rows, cols); - clear(r, rows); -} - -void difference(int **a, int **b, int rows, int cols) -{ - int i, j; - - int **r = (int **)malloc(rows * sizeof(int *)); - for (i = 0; i < rows; i++) - { - r[i] = (int *)malloc(cols * sizeof(int)); - for (j = 0; j < cols; j++) - { - r[i][j] = a[i][j] - b[i][j]; - } - } - display(r, rows, cols); - clear(r, rows); -} - -void product(int **a, int **b, int rows_a, int cols_b, int common) -{ - int i, x, y, z, temp; - - int **r = (int **)malloc(rows_a * sizeof(int *)); - for (i = 0; i < rows_a; i++) - { - r[i] = (int *)malloc(cols_b * sizeof(int)); - } - - for (x = 0; x < rows_a; x++) - { - for (y = 0; y < cols_b; y++) - { - temp = 0; - for (z = 0; z < common; z++) - { - temp += a[x][z] * b[z][y]; - } - r[x][y] = temp; - } - } - display(r, rows_a, cols_b); - clear(r, rows_a); -} - -void transpose(int **matrix, int rows, int cols) -{ - int i, j; - - int **r = (int **)malloc(cols * sizeof(int *)); - for (i = 0; i < cols; i++) - { - r[i] = (int *)malloc(rows * sizeof(int)); - for (j = 0; j < rows; j++) - { - r[i][j] = matrix[j][i]; - } - } - display(r, cols, rows); - clear(r, cols); -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-21.md b/docs/semester_1/assignment-secondary/assignment-s-21.md @@ -1,115 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-21.c' -description: 'Write a program to copy the contents of a text file to another file, after removing all white spaces (spaces, tabs, newlines).' -source: 'semester_1/assignment-secondary/assignment-s-21.c' ---- - -# assignment-s-21.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 21 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to copy the contents of a text file to another file, after removing all white spaces (spaces, tabs, newlines). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-21.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-21.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-21.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define NEW_FILE_PREFIX "cleaned_" - -int cleaning(FILE *); - -int main() -{ - char filename[50]; - char *newFilename = NULL; - FILE *givenFile = NULL; - FILE *cleanedFile = NULL; - int len, temp; - - printf("Enter the filename (Max: 50 character): "); - fgets(filename, sizeof(filename), stdin); - len = strlen(filename); - if (filename[len - 1] == '\n') - { - filename[len - 1] = '\0'; - } - - givenFile = fopen(filename, "r"); - if (givenFile == NULL) - { - printf("\nCouldn't opened the file \"%s\"" - "\nPlease ensure that \"%s\" is in the same folder.", - filename, filename); - return 1; - } - - len += strlen(NEW_FILE_PREFIX); - newFilename = (char *)malloc((len + 1) * sizeof(char)); - if (newFilename == NULL) - { - printf("\nMemory allocation failed."); - fclose(givenFile); - return 1; - } - newFilename[0] = '\0'; - strcat(newFilename, NEW_FILE_PREFIX); - strcat(newFilename, filename); - - cleanedFile = fopen(newFilename, "w"); - if (cleanedFile == NULL) - { - printf("\nCUnable to create the file \"%s\"", newFilename); - free(newFilename); - return 1; - } - - while ((temp = fgetc(givenFile)) != EOF) - { - if (temp != ' ' && temp != '\n' && temp != '\t') - { - fputc(temp, cleanedFile); - } - } - - printf("\nSuccessfully cleaned: \"%s\"", filename); - printf("\nGenerated file: \"%s\"", newFilename); - - fclose(givenFile); - fclose(cleanedFile); - free(newFilename); - - return 0; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-22.md b/docs/semester_1/assignment-secondary/assignment-s-22.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-22.c' -description: 'Write a program using structures to add two distances in meter-kilometer format.' -source: 'semester_1/assignment-secondary/assignment-s-22.c' ---- - -# assignment-s-22.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 18 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using structures to add two distances in meter-kilometer format. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-22.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-22.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-22.c] -#include <stdio.h> -#include <stdlib.h> - -struct distance -{ - int km; - int m; -}; - -void total_distance(struct distance[]); - -int main() -{ - struct distance dis[2] = {0}; - printf("Enter the 1st distance (KM M): "); - scanf("%d %d", &dis[0].km, &dis[0].m); - printf("Enter the 2nd distance: "); - scanf("%d %d", &dis[1].km, &dis[1].m); - total_distance(dis); - return 0; -} - -void total_distance(struct distance dis[]) -{ - int result_km = dis[0].km + dis[1].km; - int result_m = dis[0].m + dis[1].m; - result_km += result_m / 1000; - result_m = result_m % 1000; - printf("Total distance: %d KM, %d M", result_km, result_m); -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-23.md b/docs/semester_1/assignment-secondary/assignment-s-23.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-23.c' -description: 'Write a program to add two complex numbers using structures.' -source: 'semester_1/assignment-secondary/assignment-s-23.c' ---- - -# assignment-s-23.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 18 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to add two complex numbers using structures. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-23.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-23.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-23.c] -#include <stdio.h> -#include <stdlib.h> - -struct complex_number -{ - double real; - double imaginary; -}; - -int main() -{ - struct complex_number a, b; - printf("Enter the 1st complex number in this format (a+bi): "); - scanf("%lf+%lfi", &a.real, &a.imaginary); - printf("Enter the 2nd complex number in this format (a+bi): "); - scanf("%lf+%lfi", &b.real, &b.imaginary); - - printf("Result = %-2g + %-2.2g", a.real + b.real, a.imaginary + b.imaginary); - return 0; -} -``` diff --git a/docs/semester_1/assignment-secondary/assignment-s-24.md b/docs/semester_1/assignment-secondary/assignment-s-24.md @@ -1,76 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> assignment-s-24.c' -description: 'Write a program to calculate the difference between two time periods using structures.' -source: 'semester_1/assignment-secondary/assignment-s-24.c' ---- - -# assignment-s-24.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 18 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate the difference between two time periods using structures. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/assignment-secondary/assignment-s-24.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/assignment-secondary/assignment-s-24.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [assignment-s-24.c] -#include <stdio.h> -#include <stdlib.h> - -struct time_dif -{ - int hour; - int min; - int sec; -}; - -int main() -{ - struct time_dif tpA, tpB; - long int tfA, tfB, tdif; - printf("Enter the start time in this 24 hours clock format (HH MM SS): "); - scanf("%d %d %d", &tpA.hour, &tpA.min, &tpA.sec); - printf("Enter the end time in this 24 hours clock format (HH MM SS): "); - scanf("%d %d %d", &tpB.hour, &tpB.min, &tpB.sec); - - tfA = tpA.hour * 3600 + tpA.min * 60 + tpA.sec; - tfB = tpB.hour * 3600 + tpB.min * 60 + tpB.sec; - tdif = tfB - tfA; - if (tdif < 0) - { - printf("\nWrong information, End time should be later than Start time."); - return 1; - } - printf("\nTime difference: %ld Hour(s) %ld Minutes(s) %ld Second(s).", tdif / 3600, (tdif % 3600) / 60, (tdif % 3600) % 60); - - return 0; -} -``` diff --git a/docs/semester_1/assignment-secondary/index.md b/docs/semester_1/assignment-secondary/index.md @@ -1,34 +0,0 @@ -# Assignment Secondary - -Files and sub-folders in **Assignment Secondary**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `assignment-s-01.c` | [View Code](assignment-s-01.md) | -| 2 | `assignment-s-02.c` | [View Code](assignment-s-02.md) | -| 3 | `assignment-s-03.c` | [View Code](assignment-s-03.md) | -| 4 | `assignment-s-04.c` | [View Code](assignment-s-04.md) | -| 5 | `assignment-s-05.c` | [View Code](assignment-s-05.md) | -| 6 | `assignment-s-06.c` | [View Code](assignment-s-06.md) | -| 7 | `assignment-s-07.c` | [View Code](assignment-s-07.md) | -| 8 | `assignment-s-08.c` | [View Code](assignment-s-08.md) | -| 9 | `assignment-s-09.c` | [View Code](assignment-s-09.md) | -| 10 | `assignment-s-10.c` | [View Code](assignment-s-10.md) | -| 11 | `assignment-s-11.c` | [View Code](assignment-s-11.md) | -| 12 | `assignment-s-12.c` | [View Code](assignment-s-12.md) | -| 13 | `assignment-s-13-1.c` | [View Code](assignment-s-13-1.md) | -| 14 | `assignment-s-13-2.c` | [View Code](assignment-s-13-2.md) | -| 15 | `assignment-s-14.c` | [View Code](assignment-s-14.md) | -| 16 | `assignment-s-15.c` | [View Code](assignment-s-15.md) | -| 17 | `assignment-s-16.c` | [View Code](assignment-s-16.md) | -| 18 | `assignment-s-17.c` | [View Code](assignment-s-17.md) | -| 19 | `assignment-s-18.c` | [View Code](assignment-s-18.md) | -| 20 | `assignment-s-19.c` | [View Code](assignment-s-19.md) | -| 21 | `assignment-s-20.c` | [View Code](assignment-s-20.md) | -| 22 | `assignment-s-21.c` | [View Code](assignment-s-21.md) | -| 23 | `assignment-s-22.c` | [View Code](assignment-s-22.md) | -| 24 | `assignment-s-23.c` | [View Code](assignment-s-23.md) | -| 25 | `assignment-s-24.c` | [View Code](assignment-s-24.md) | - diff --git a/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-10.md b/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-10.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> Qn-10.c' -description: 'Write a C program to find the maximum element in each row of a 2D array and print the result.' -source: 'semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-10.c' ---- - -# Qn-10.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Mar 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to find the maximum element in each row of a 2D array and print the result. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [Qn-10.c] -#include <stdio.h> - -void findMax(int row, int col, int[row][col]); - -int main() -{ - int row = 3, col = 3, i, j, val = 1; - int arr[row][col]; - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - { - arr[i][j] = val++; - } - } - findMax(row, col, arr); - return 0; -} - -void findMax(int row, int col, int arr[row][col]) -{ - int i, j; - int max; - for (i = 0; i < row; i++) - { - max = arr[i][0]; - for (j = 0; j < col; j++) - { - if(max < arr[i][j]) { - max = arr[i][j]; - } - } - printf("Max of row %d = %d\n", i, max); - } -} -``` diff --git a/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-8.md b/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-8.md @@ -1,94 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> Qn-8.c' -description: 'Write a C program to find the transpose of a given square matrix using 2D array. The transpose of a matrix is obtained by swapping the rows and columns of the matrix' -source: 'semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-8.c' ---- - -# Qn-8.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Mar 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to find the transpose of a given square matrix using 2D array. The transpose of a matrix is obtained by swapping the rows and columns of the matrix -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-8.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-8.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [Qn-8.c] -#include <stdio.h> - -void transpose(int row, int col, int[row][col]); -void print(int row, int col, int[row][col]); - -int main() -{ - int row = 3, col = 3, i, j, val = 1; - int arr[row][col]; - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - { - arr[i][j] = val++; - } - } - printf("Before Transpose: \n"); - print(row, col, arr); - transpose(row, col, arr); - return 0; -} - -void transpose(int row, int col, int arr[row][col]) -{ - int i, j; - int res[col][row]; - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - { - res[j][i] = arr[i][j]; - } - } - printf("\nAfter Transpose: \n"); - print(row, col, res); -} - -void print(int row, int col, int arr[row][col]) -{ - int i, j; - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - { - printf("%d ", arr[i][j]); - } - printf("\n"); - } -} -``` diff --git a/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-9.md b/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-9.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> Qn-9.c' -description: 'Write a C program to find sum of all elements in a given 2D array.' -source: 'semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-9.c' ---- - -# Qn-9.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Mar 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to find sum of all elements in a given 2D array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-9.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/eduincs_exam/Paper-1_05-03-2026/Qn-9.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [Qn-9.c] -#include <stdio.h> - -int findSum(int row, int col, int[row][col]); - -int main() -{ - int row = 3, col = 3, i, j, val = 1; - int arr[row][col]; - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - { - arr[i][j] = val++; - } - } - printf("Sum: %d", findSum(row, col, arr)); - return 0; -} - -int findSum(int row, int col, int arr[row][col]) -{ - int i, j; - int sum = 0; - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - { - sum += arr[i][j]; - } - } - return sum; -} -``` diff --git a/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/index.md b/docs/semester_1/eduincs_exam/Paper-1_05-03-2026/index.md @@ -1,12 +0,0 @@ -# Paper 1 05 03 2026 - -Files and sub-folders in **Paper 1 05 03 2026**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `Qn-10.c` | [View Code](Qn-10.md) | -| 2 | `Qn-8.c` | [View Code](Qn-8.md) | -| 3 | `Qn-9.c` | [View Code](Qn-9.md) | - diff --git a/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-11.md b/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-11.md @@ -1,90 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> Qn-11.c' -description: 'Write a program to explain, how an array of stucture can you defined and accessed.' -source: 'semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-11.c' ---- - -# Qn-11.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Mar 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to explain, how an array of stucture can you defined and accessed. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [Qn-11.c] -#include <stdio.h> -#include <string.h> - -// 1. Defining the Structure -struct Student { - int rollNo; - char name[50]; - float marks; -}; - -int main() { - int n, i; - - printf("Enter the number of students: "); - scanf("%d", &n); - - // 2. Defining an Array of Structures - // This creates 'n' blocks of memory, each large enough to hold a Student - struct Student s[n]; - - // 3. Accessing members to STORE data - for (i = 0; i < n; i++) { - printf("\nEnter details for Student %d:\n", i + 1); - printf("Roll No: "); - scanf("%d", &s[i].rollNo); // Using dot (.) operator with index [i] - - printf("Name: "); - getchar(); // To clear the newline character from buffer - fgets(s[i].name, sizeof(s[i].name), stdin); - s[i].name[strcspn(s[i].name, "\n")] = '\0'; // Safe newline removal - - printf("Marks: "); - scanf("%f", &s[i].marks); - } - - // 4. Accessing members to DISPLAY data - printf("\n--- Student Records ---\n"); - printf("ID\tName\t\tMarks\n"); - for (i = 0; i < n; i++) { - // Accessing using s[i].member - printf("%d\t%-15s\t%.2f\n", s[i].rollNo, s[i].name, s[i].marks); - } - - return 0; -} -``` diff --git a/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-3.md b/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-3.md @@ -1,100 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> Qn-3.c' -description: 'Write a program to search an element from an array using linear search technique using malloc() and free() for memory allocation and deallocation.' -source: 'semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-3.c' ---- - -# Qn-3.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Mar 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to search an element from an array using linear search technique using malloc() and free() for memory allocation and deallocation. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-3.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-3.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [Qn-3.c] -#include <stdio.h> -#include <stdlib.h> - -int inputArray(int[], int); -int linearSearch(int[], int, int); - -int main() -{ - int size, *arr = NULL; - printf("How many element do you want to enter: "); - scanf("%d", &size); - arr = (int *)malloc(size * sizeof(int)); - if (arr == NULL) - { - printf("Memory allocation failed! Exiting...\n"); - return 1; - } - int target = inputArray(arr, size); - int index = linearSearch(arr, size, target); - if (index != -1) - { - printf("\nElement %d is found at index %d.", target, index); - } - else - { - printf("\nElement %d is not found.", target); - } - free(arr); - return 0; -} - -int inputArray(int arr[], int size) -{ - int i, target; - for (i = 0; i < size; i++) - { - printf("Enter element for position %d: ", i); - scanf("%d", &arr[i]); - } - printf("\nEnter the target element: "); - scanf("%d", &target); - return target; -} - -int linearSearch(int arr[], int size, int target) -{ - for (int i = 0; i < size; i++) - { - if (arr[i] == target) - { - return i; - } - } - return -1; -} -``` diff --git a/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-4.md b/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-4.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> Qn-4.c' -description: 'Write a program to check a string is palindrome or not using user-defined function.' -source: 'semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-4.c' ---- - -# Qn-4.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Mar 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check a string is palindrome or not using user-defined function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-4.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/eduincs_exam/Paper-2_05-03-2026/Qn-4.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [Qn-4.c] -#include <stdio.h> -#include <string.h> -#include <stdbool.h> -#include <ctype.h> - -bool isPalindrome(char str[]); - -int main() { - char str[100]; - - printf("Enter a string: "); - fgets(str, sizeof(str), stdin); - str[strcspn(str, "\n")] = '\0'; - if (isPalindrome(str)) { - printf("\"%s\" is a palindrome.\n", str); - } else { - printf("\"%s\" is not a palindrome.\n", str); - } - return 0; -} - -bool isPalindrome(char str[]) { - int left = 0; - int right = strlen(str) - 1; - - while (right > left) { - if (tolower(str[left]) != tolower(str[right])) { - return false; - } - left++; - right--; - } - return true; -} -``` diff --git a/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/index.md b/docs/semester_1/eduincs_exam/Paper-2_05-03-2026/index.md @@ -1,12 +0,0 @@ -# Paper 2 05 03 2026 - -Files and sub-folders in **Paper 2 05 03 2026**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `Qn-11.c` | [View Code](Qn-11.md) | -| 2 | `Qn-3.c` | [View Code](Qn-3.md) | -| 3 | `Qn-4.c` | [View Code](Qn-4.md) | - diff --git a/docs/semester_1/eduincs_exam/index.md b/docs/semester_1/eduincs_exam/index.md @@ -1,11 +0,0 @@ -# Eduincs Exam - -Files and sub-folders in **Eduincs Exam**. - -## Folders - -| # | Folder | Link | -|---|---|---| -| 1 | Paper 1 05 03 2026 | [Open](Paper-1_05-03-2026/index.md) | -| 2 | Paper 2 05 03 2026 | [Open](Paper-2_05-03-2026/index.md) | - diff --git a/docs/semester_1/internal-practice/IP-01.md b/docs/semester_1/internal-practice/IP-01.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-01.c' -description: 'Write a program to compute the sum and product of digits of an integer using user defined functions.' -source: 'semester_1/internal-practice/IP-01.c' ---- - -# IP-01.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to compute the sum and product of digits of an integer using user defined functions. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-01.c] -#include <stdio.h> - -int sum_of_digits(int); -int product_of_digits(int); - -int main() -{ - int num; - printf("Enter the number: "); - scanf("%d", &num); - printf("\nSum of digits of %d = %d", num, sum_of_digits(num)); - printf("\nProduct of digits of %d = %d", num, product_of_digits(num)); - return 0; -} - -int sum_of_digits(int num) -{ - int sum = 0; - while (num > 0) - { - sum += num % 10; - num /= 10; - } - return sum; -} - -int product_of_digits(int num) -{ - int product = 1; - while (num > 0) - { - product *= num % 10; - num /= 10; - } - return product; -} -``` diff --git a/docs/semester_1/internal-practice/IP-02.md b/docs/semester_1/internal-practice/IP-02.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-02.c' -description: 'Write a program to reverse a non-negative integer using a function.' -source: 'semester_1/internal-practice/IP-02.c' ---- - -# IP-02.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to reverse a non-negative integer using a function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-02.c] -#include <stdio.h> - -int reverse(int); - -int main() -{ - int num; - printf("Enter a non-negetive integer: "); - scanf("%d", &num); - if (num < 0) - { - printf("\nOnly non-negetive integers are allowed."); - return 1; - } - printf("\nReverse of the integer %d = %d", num, reverse(num)); - return 0; -} - -int reverse(int num) -{ - int rev = 0; - while (num > 0) - { - rev = (rev * 10) + (num % 10); - num /= 10; - } - return rev; -} -``` diff --git a/docs/semester_1/internal-practice/IP-03.md b/docs/semester_1/internal-practice/IP-03.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-03.c' -description: 'Write a program to compute the sum of the first n terms of the series using a function: S=1−2+3−4+5−6+…' -source: 'semester_1/internal-practice/IP-03.c' ---- - -# IP-03.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to compute the sum of the first n terms of the series using a function: S=1−2+3−4+5−6+… -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-03.c] -#include <stdio.h> - -int sum_of_series(int); - -int main() -{ - int n; - printf("Enter the n: "); - scanf("%d", &n); - printf("\nSum of the first %d terms of the series = %d", n, sum_of_series(n)); - return 0; -} - -int sum_of_series(int n) -{ - int sum = 0; - int i; - for (i = 1; i <= n; i++) - { - if (i % 2 == 0) - { - sum -= i; - } - else - { - sum += i; - } - } - return sum; -} -``` diff --git a/docs/semester_1/internal-practice/IP-04.md b/docs/semester_1/internal-practice/IP-04.md @@ -1,94 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-04.c' -description: 'Write a function to check whether a number is prime or not. Use the same function to generate all prime numbers less than 100.' -source: 'semester_1/internal-practice/IP-04.c' ---- - -# IP-04.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function to check whether a number is prime or not. Use the same function to generate all prime numbers less than 100. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-04.c] -#include <stdio.h> -#include <math.h> - -int isPrime(int); - -int main() -{ - int n, i; - printf("Enter the number: "); - scanf("%d", &n); - if (isPrime(n)) - { - printf("\nInput %d is a Prime Number.", n); - } - else - { - printf("\nInput %d is not a Prime Number.", n); - } - printf("\nPrime Numbers less than 100:"); - for (i = 1; i < 100; i++) - { - if (isPrime(i)) - { - printf(" %d", i); - } - } - return 0; -} - -int isPrime(int n) -{ - if (n <= 1) - return 0; - if (n == 2) - return 1; - if (n % 2 == 0) - return 0; - - int temp = (int)sqrt(n); - int i; - for (i = 3; i <= temp; i += 2) - { - if (n % i == 0) - { - return 0; - } - } - return 1; -} -``` diff --git a/docs/semester_1/internal-practice/IP-05.md b/docs/semester_1/internal-practice/IP-05.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-05.c' -description: 'Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome.' -source: 'semester_1/internal-practice/IP-05.c' ---- - -# IP-05.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-05.c] -#include <stdio.h> -#include <string.h> - -int isPalindrome(char[]); - -int main() -{ - char input[100]; - int len; - - printf("Enter the string (Max: 100 Character): "); - fgets(input, sizeof(input), stdin); - len = strlen(input); - - if (len > 0 && input[len - 1] == '\n') - { - input[len - 1] = '\0'; - } - - if (isPalindrome(input)) - { - printf("\nInput string \"%s\" is Palindrome.", input); - } - else - { - printf("\nInput string \"%s\" is not Palindrome", input); - } - - return 0; -} - -int isPalindrome(char str[]) -{ - char *start = str; - char *end; - int len = strlen(str); - - if (len == 0) - { - return 1; - } - - end = str + (len - 1); - - while (start < end) - { - if (*start != *end) - { - return 0; - } - start++; - end--; - } - - return 1; -} -``` diff --git a/docs/semester_1/internal-practice/IP-06.md b/docs/semester_1/internal-practice/IP-06.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-06.c' -description: 'Write a program using a function to compute and display all factors of a given number.' -source: 'semester_1/internal-practice/IP-06.c' ---- - -# IP-06.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using a function to compute and display all factors of a given number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-06.c] -#include <stdio.h> -#include <stdlib.h> - -void display_factors(int); - -int main() -{ - int num, i; - printf("Please enter the number to get the factors from it : "); - scanf("%d", &num); - display_factors(num); - return 0; -} - -void display_factors(int num) { - int temp = abs(num); - int i; - - if (temp == 0) - { - printf("\n0 has infinitely many factors (all integers)."); - exit(1); - } - - printf("\nThe factors of ' %d ' is :- ", num); - printf("\nPositive : "); - for (i = 1; i <= temp; i++) - if (temp % i == 0) - printf(" %d", i); - printf("\nNegative : "); - for (i = 1; i <= temp; i++) - if (temp % i == 0) - printf(" %d", -i); -} -``` diff --git a/docs/semester_1/internal-practice/IP-07.md b/docs/semester_1/internal-practice/IP-07.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-07.c' -description: 'Write a program to swap two numbers using pointers (user-defined function).' -source: 'semester_1/internal-practice/IP-07.c' ---- - -# IP-07.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to swap two numbers using pointers (user-defined function). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-07.c] -#include <stdio.h> - -void swap(int *, int *); - -int main() -{ - int a, b; - printf("Enter value for a and b: "); - scanf("%d %d", &a, &b); - printf("\nBefore Swap: "); - printf("\na = %d,\tAddress: %u", a, &a); - printf("\nb = %d,\tAddress: %u", b, &b); - swap(&a, &b); - printf("\nAfter Swap: "); - printf("\na = %d,\tAddress: %u", a, &a); - printf("\nb = %d,\tAddress: %u", b, &b); - return 0; -} - -void swap(int *a, int *b) -{ - *a = *a ^ *b; - *b = *a ^ *b; - *a = *a ^ *b; -} -``` diff --git a/docs/semester_1/internal-practice/IP-08.md b/docs/semester_1/internal-practice/IP-08.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-08.c' -description: 'Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main().' -source: 'semester_1/internal-practice/IP-08.c' ---- - -# IP-08.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main(). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-08.c] -#include <stdio.h> -#include <math.h> - -void area_circumference(double, double *, double *); - -int main() -{ - double r, area, circumference; - printf("Enter the radius of the circle: "); - scanf("%lf", &r); - area_circumference(r, &area, &circumference); - printf("\nArea of the circle = %g", area); - printf("\nCircumference of the circle = %g", circumference); - return 0; -} - -void area_circumference(double r, double *area, double *circumference) -{ - *area = M_PI * r * r; - *circumference = 2 * M_PI * r; -} -``` diff --git a/docs/semester_1/internal-practice/IP-09.md b/docs/semester_1/internal-practice/IP-09.md @@ -1,82 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-09.c' -description: 'Write a program to find the sum of n elements entered by the user. Use dynamic memory allocation (malloc() or calloc()).' -source: 'semester_1/internal-practice/IP-09.c' ---- - -# IP-09.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the sum of n elements entered by the user. Use dynamic memory allocation (malloc() or calloc()). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-09.c] -#include <stdio.h> -#include <stdlib.h> - -void inputarr(int[], int); -int sum_elem(int[], int); - -int main() -{ - int n, *arr; - printf("How many element do you want to enter: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - inputarr(arr, n); - printf("\nSum of the %d element(s) = %d", n, sum_elem(arr, n)); - free(arr); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int sum_elem(int arr[], int n) -{ - int i, sum = 0; - for (i = 0; i < n; i++) - { - sum += arr[i]; - } - return sum; -} -``` diff --git a/docs/semester_1/internal-practice/IP-10.md b/docs/semester_1/internal-practice/IP-10.md @@ -1,112 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-10.c' -description: 'Write a function that reverses the elements of an array in place, using only a single pointer argument, and return void.' -source: 'semester_1/internal-practice/IP-10.c' ---- - -# IP-10.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function that reverses the elements of an array in place, using only a single pointer argument, and return void. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-10.c] -#include <stdio.h> -#include <stdlib.h> - -void inputArray(int[], int); -void printArray(int[], int); -void reverse(int *); - -int main() -{ - int n, i, *arr = NULL; - printf("Enter the number of element: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - if (arr == NULL) - { - printf("\nMemory allocation failed."); - return 1; - } - inputArray(arr, n); - printf("\nGiven Array: "); - printArray(arr, n); - for (i = 0; i < n; i++) - { - reverse(&arr[i]); - } - printf("\nUpdated Array: "); - printArray(arr, n); - free(arr); - return 0; -} - -void inputArray(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void printArray(int arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); -} - -void reverse(int *n) -{ - int temp = *n; - int rev = 0; - while (temp > 0) - { - rev = (rev * 10) + (temp % 10); - temp /= 10; - } - *n = rev; -} -``` diff --git a/docs/semester_1/internal-practice/IP-11.md b/docs/semester_1/internal-practice/IP-11.md @@ -1,92 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-11.c' -description: 'Write a program to merge two sorted integer arrays to form a single sorted array.' -source: 'semester_1/internal-practice/IP-11.c' ---- - -# IP-11.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to merge two sorted integer arrays to form a single sorted array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-11.c] -#include <stdio.h> -#include <stdlib.h> - -void merge(int[], int, int[], int); - -int main() -{ - int a[] = {10, 30, 50, 70, 90}; - int b[] = {20, 40, 60, 80, 100}; - int n1 = sizeof(a) / sizeof(a[0]); - int n2 = sizeof(b) / sizeof(b[0]); - merge(a, n1, b, n2); - return 0; -} - -void merge(int a[], int n1, int b[], int n2) -{ - int n = n1 + n2; - int *c = (int *)malloc(n * sizeof(int)); - int i, j, k; - i = j = k = 0; - while (i < n1 && j < n2) - { - if (a[i] < b[j]) - { - c[k++] = a[i++]; - } - else - { - c[k++] = b[j++]; - } - } - while (i < n1) - { - c[k++] = a[i++]; - } - while (j < n2) - { - c[k++] = b[j++]; - } - printf("Merged Array:"); - for (i = 0; i < n; i++) - { - printf(" %d", c[i]); - } - free(c); -} -``` diff --git a/docs/semester_1/internal-practice/IP-12.md b/docs/semester_1/internal-practice/IP-12.md @@ -1,111 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-12.c' -description: 'Write a program that reads 10 integers into an array (using pointers), and prints the array in ascending and descending order.' -source: 'semester_1/internal-practice/IP-12.c' ---- - -# IP-12.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that reads 10 integers into an array (using pointers), and prints the array in ascending and descending order. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-12.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-12.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-12.c] -#include <stdio.h> -#include <stdlib.h> - -#define true 1 -#define false 0 - -void input_arr(int *, int); -void print(int *, int); - -int main() -{ - int arr[10]; - input_arr(arr, 10); - print(arr, 10); - return 0; -} - -void input_arr(int *arr, int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", arr + i); - } -} - -void print(int *arr, int n) -{ - int i, j, isSwaped = true, backup; - int *temp = (int *)malloc(n * sizeof(int)); - if (temp == NULL) - { - printf("\nMemory Allocation Failed."); - return; - } - for (i = 0; i < n; i++) - { - *(temp + i) = *(arr + i); - } - for (i = 0; i < n - 1 && isSwaped == true; i++) - { - isSwaped = false; - for (j = 0; j < n - i - 1; j++) - { - if (*(temp + j) > *(temp + j + 1)) - { - backup = *(temp + j); - *(temp + j) = *(temp + j + 1); - *(temp + j + 1) = backup; - isSwaped = true; - } - } - } - printf("\nAscending Order:"); - for (i = 0; i < n; i++) - { - printf(" %d", *(temp + i)); - } - printf("\nDescending Order:"); - for (i = n - 1; i >= 0; i--) - { - printf(" %d", *(temp + i)); - } - free(temp); -} -``` diff --git a/docs/semester_1/internal-practice/IP-13.md b/docs/semester_1/internal-practice/IP-13.md @@ -1,126 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-13.c' -description: 'Write a program to display the Fibonacci series (i) using recursion (ii) using iteration' -source: 'semester_1/internal-practice/IP-13.c' ---- - -# IP-13.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to display the Fibonacci series (i) using recursion (ii) using iteration -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-13.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-13.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-13.c] -#include <stdio.h> - -long long int fib_rec(int); -long long int fib_tail_rec(int, long long int, long long int); -void fib_rec_print(int); -void fib_ite_print(int); - -int main() -{ - int n; - printf("Enter the number of terms: "); - scanf("%d", &n); - fib_rec_print(n); - fib_ite_print(n); - return 0; -} - -long long int fib_rec(int n) -{ - if (n == 0 || n == 1) - { - return n; - } - else - { - return fib_rec(n - 1) + fib_rec(n - 2); - } -} - -long long int fib_tail_rec(int n, long long int t1, long long int t2) -{ - if (n == 0) - { - return t1; - } - else if (n == 1) - { - return t2; - } - else - { - return fib_tail_rec(n - 1, t2, t1 + t2); - } -} - -void fib_rec_print(int n) -{ - int i; - printf("\nFibonacci Series (Recursion):"); - for (i = 0; i < n; i++) - { - printf(" %lld", fib_rec(i)); - } - printf("\nFibonacci Series (Tail-Recursion):"); - for (i = 0; i < n; i++) - { - printf(" %lld", fib_tail_rec(i, 0, 1)); - } -} - -void fib_ite_print(int n) -{ - int i; - long long int t1 = 0, t2 = 1, temp; - printf("\nFibonacci Series (Iteration):"); - if (n > 0) - { - printf(" 0"); - } - if (n > 1) - { - printf(" 1"); - } - for (i = 2; i < n; i++) - { - printf(" %lld", t1 + t2); - temp = t1; - t1 = t2; - t2 = temp + t2; - } -} -``` diff --git a/docs/semester_1/internal-practice/IP-14.md b/docs/semester_1/internal-practice/IP-14.md @@ -1,105 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-14.c' -description: 'Write a program to calculate the factorial of a number (i) using recursion (ii) using iteration' -source: 'semester_1/internal-practice/IP-14.c' ---- - -# IP-14.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate the factorial of a number (i) using recursion (ii) using iteration -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-14.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-14.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-14.c] -#include <stdio.h> - -long long int fact_tail_rec(int, long long int); -long long int fact_rec(int); -long long int fact_ite(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - if (n < 0) - { - printf("\nFactorial of negetive number is not possible."); - return 1; - } - printf("\nFactorial of %d (Tail-Recursion) = %lld", n, fact_tail_rec(n, 1)); - printf("\nFactorial of %d (Recursion) = %lld", n, fact_rec(n)); - printf("\nFactorial of %d (Iteration) = %lld", n, fact_ite(n)); - return 0; -} - -long long int fact_tail_rec(int n, long long int result) -{ - if (n == 0 || n == 1) - { - return result; - } - else - { - return fact_tail_rec(n - 1, n * result); - } -} - -long long int fact_rec(int n) -{ - if (n == 0 || n == 1) - { - return 1; - } - else - { - return n * fact_rec(n - 1); - } -} - -long long int fact_ite(int n) -{ - int i; - long long int result = 1; - if (n == 0 || n == 1) - { - return 1; - } - for (i = 2; i <= n; i++) - { - result *= i; - } - return result; -} -``` diff --git a/docs/semester_1/internal-practice/IP-15.md b/docs/semester_1/internal-practice/IP-15.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-15.c' -description: 'Write a program to calculate the GCD of two numbers (i) using recursion (ii) without recursion' -source: 'semester_1/internal-practice/IP-15.c' ---- - -# IP-15.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate the GCD of two numbers (i) using recursion (ii) without recursion -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-15.c] -#include <stdio.h> - -int gcd_tail_rec(int, int); -int gcd_rec(int, int); -int gcd_ite(int, int); - -int main() -{ - int a, b; - printf("Enter two number: "); - scanf("%d %d", &a, &b); - if (a < 0) - a = -a; - if (b < 0) - b = -b; - printf("\nGCD (Tail-Recursion) of %d and %d is = %d", a, b, gcd_tail_rec(a, b)); - printf("\nGCD (Recursion) of %d and %d is = %d", a, b, gcd_rec(a, b)); - printf("\nGCD (Iteration) of %d and %d is = %d", a, b, gcd_ite(a, b)); - return 0; -} - -int gcd_tail_rec(int a, int b) -{ - if (b == 0) - { - return a; - } - else - { - return gcd_tail_rec(b, a % b); - } -} - -int gcd_rec(int a, int b) -{ - if (b == 0) - { - return a; - } - else - { - return gcd_rec(b, a % b); - } -} - -int gcd_ite(int a, int b) -{ - int temp; - while (b > 0) - { - temp = b; - b = a % b; - a = temp; - } - return a; -} -``` diff --git a/docs/semester_1/internal-practice/IP-16.md b/docs/semester_1/internal-practice/IP-16.md @@ -1,99 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-16.c' -description: 'Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);. An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153' -source: 'semester_1/internal-practice/IP-16.c' ---- - -# IP-16.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);. An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-16.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-16.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-16.c] -#include <stdio.h> -#include <math.h> - -int isArmstrong(int); -int count(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - - if (isArmstrong(n)) - { - printf("\nInput %d is a Armstrong Number.", n); - } - else - { - printf("\nInput %d is Not a Armstrong Number.", n); - } - - return 0; -} - -int count(int n) -{ - int count = 0; - while (n > 0) - { - count++; - n = n / 10; - } - return count; -} - -int isArmstrong(int n) -{ - if (n < 0) - return 0; - if (n == 0) - return 1; - - int power = count(n); - int temp = n; - int checker = 0; - - while (temp > 0) - { - int digit = temp % 10; - checker = checker + (int)round(pow(digit, power)); - temp = temp / 10; - } - return n == checker; -} -``` diff --git a/docs/semester_1/internal-practice/IP-17.md b/docs/semester_1/internal-practice/IP-17.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-17.c' -description: 'Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, 28 is a perfect number because the sum of its divisors (1, 2, 4, 7, 14) equals 28.' -source: 'semester_1/internal-practice/IP-17.c' ---- - -# IP-17.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, 28 is a perfect number because the sum of its divisors (1, 2, 4, 7, 14) equals 28. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-17.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-17.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-17.c] -#include <stdio.h> - -int isPerfect(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - if (isPerfect(n)) - { - printf("\nInput %d is a Perfect Number.", n); - } - else - { - printf("\nInput %d is not a Perfect Number.", n); - } - return 0; -} - -int isPerfect(int n) -{ - if (n <= 1) - return 0; - int temp = 1; - int i; - for (i = 2; i <= n / 2; i++) - { - if (n % i == 0) - { - temp += i; - } - } - return temp == n; -} -``` diff --git a/docs/semester_1/internal-practice/IP-18.md b/docs/semester_1/internal-practice/IP-18.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-18.c' -description: 'Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);. The function should take an array of integers and its size, and return the largest element in the array.' -source: 'semester_1/internal-practice/IP-18.c' ---- - -# IP-18.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);. The function should take an array of integers and its size, and return the largest element in the array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-18.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-18.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-18.c] -#include <stdio.h> - -void inputArray(int[], int); -int findLargest(int[], int); - -int main() -{ - int size; - printf("How many element do you want to enter: "); - scanf("%d", &size); - int arr[size]; - inputArray(arr, size); - printf("\nLargest Element is: %d", findLargest(arr, size)); - return 0; -} - -void inputArray(int arr[], int size) -{ - int i; - for (i = 0; i < size; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int findLargest(int arr[], int size) -{ - int largest = arr[0], i; - for (i = 1; i < size; i++) - { - if (largest < arr[i]) - { - largest = arr[i]; - } - } - return largest; -} -``` diff --git a/docs/semester_1/internal-practice/IP-19.md b/docs/semester_1/internal-practice/IP-19.md @@ -1,147 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-19.c' -description: 'Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);. The function should perform a binary search on a sorted array of integers and return the index of the target element if found, and -1 otherwise.' -source: 'semester_1/internal-practice/IP-19.c' ---- - -# IP-19.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);. The function should perform a binary search on a sorted array of integers and return the index of the target element if found, and -1 otherwise. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-19.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-19.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-19.c] -#include <stdio.h> - -int inputArray(int[], int); -// void sortArray(int[], int); -int binarySearch(int[], int, int); - -int main() -{ - int size; - printf("How many element do you want to enter: "); - scanf("%d", &size); - int arr[size]; - int target = inputArray(arr, size); - // sortArray(arr, size); // If needed - int index = binarySearch(arr, size, target); - if (index != -1) - { - printf("\nElement %d is found at index %d.", target, index); - } - else - { - printf("\nElement %d is not found.", target); - } - return 0; -} - -int inputArray(int arr[], int size) -{ - int i, target; - for (i = 0; i < size; i++) - { - printf("Enter element for position %d: ", i); - scanf("%d", &arr[i]); - } - printf("\nEnter the target element: "); - scanf("%d", &target); - return target; -} - -/* void sortArray(int arr[], int size) -{ - // using Bubble Sort... - - int tempArr[size], i, j, temp; - printf("\nBefore Sorting:\n["); - for (i = 0; i < size; i++) - { - printf("%d", arr[i]); - if (i != size - 1) - { - printf(", "); - } - } - printf("]\n"); - for (i = 0; i < size - 1; i++) - { - for (j = 0; j < size - i - 1; j++) - { - if (arr[j] > arr[j + 1]) - { - temp = arr[j]; - arr[j] = arr[j + 1]; - arr[j + 1] = temp; - } - } - } - printf("\nAfter Sorting:\n["); - for (i = 0; i < size; i++) - { - printf("%d", arr[i]); - if (i != size - 1) - { - printf(", "); - } - } - printf("]\n"); -} -*/ - -int binarySearch(int arr[], int size, int target) -{ - int low = 0; - int high = size - 1; - int mid; - while (low <= high) - { - mid = low + ((high - low) / 2); - if (arr[mid] == target) - { - return mid; - } - else if (arr[mid] > target) - { - high = mid - 1; - } - else if (arr[mid] < target) - { - low = mid + 1; - } - } - return -1; -} -``` diff --git a/docs/semester_1/internal-practice/IP-20.md b/docs/semester_1/internal-practice/IP-20.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> IP-20.c' -description: 'Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);. The function should reverse the elements of the array.' -source: 'semester_1/internal-practice/IP-20.c' ---- - -# IP-20.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 03 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);. The function should reverse the elements of the array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/internal-practice/IP-20.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/internal-practice/IP-20.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [IP-20.c] -#include <stdio.h> - -void inputArray(int[], int); -void reverseArray(int[], int); - -int main() -{ - int size; - printf("How many element do you want to add: "); - scanf("%d", &size); - int arr[size]; - inputArray(arr, size); - reverseArray(arr, size); - return 0; -} - -void inputArray(int arr[], int size) -{ - int i; - for (i = 0; i < size; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void reverseArray(int arr[], int size) -{ - int i, j, temp; - printf("\nBefore Reverse: \n"); - for (i = 0; i < size; i++) - { - printf("Position: %d, Value: %d\n", i, arr[i]); - } - for (i = 0, j = size - 1; i < j; i++, j--) - { - temp = arr[i]; - arr[i] = arr[j]; - arr[j] = temp; - } - printf("\nAfter Reverse: \n"); - for (i = 0; i < size; i++) - { - printf("Position: %d, Value: %d\n", i, arr[i]); - } -} -``` diff --git a/docs/semester_1/internal-practice/index.md b/docs/semester_1/internal-practice/index.md @@ -1,29 +0,0 @@ -# Internal Practice - -Files and sub-folders in **Internal Practice**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `IP-01.c` | [View Code](IP-01.md) | -| 2 | `IP-02.c` | [View Code](IP-02.md) | -| 3 | `IP-03.c` | [View Code](IP-03.md) | -| 4 | `IP-04.c` | [View Code](IP-04.md) | -| 5 | `IP-05.c` | [View Code](IP-05.md) | -| 6 | `IP-06.c` | [View Code](IP-06.md) | -| 7 | `IP-07.c` | [View Code](IP-07.md) | -| 8 | `IP-08.c` | [View Code](IP-08.md) | -| 9 | `IP-09.c` | [View Code](IP-09.md) | -| 10 | `IP-10.c` | [View Code](IP-10.md) | -| 11 | `IP-11.c` | [View Code](IP-11.md) | -| 12 | `IP-12.c` | [View Code](IP-12.md) | -| 13 | `IP-13.c` | [View Code](IP-13.md) | -| 14 | `IP-14.c` | [View Code](IP-14.md) | -| 15 | `IP-15.c` | [View Code](IP-15.md) | -| 16 | `IP-16.c` | [View Code](IP-16.md) | -| 17 | `IP-17.c` | [View Code](IP-17.md) | -| 18 | `IP-18.c` | [View Code](IP-18.md) | -| 19 | `IP-19.c` | [View Code](IP-19.md) | -| 20 | `IP-20.c` | [View Code](IP-20.md) | - diff --git a/docs/semester_1/khurapati-idea/KI001.md b/docs/semester_1/khurapati-idea/KI001.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> KI001.c' -description: 'C program — KI001.c' -source: 'semester_1/khurapati-idea/KI001.c' ---- - -# KI001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/khurapati-idea/KI001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/khurapati-idea/KI001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [KI001.c] -#include <stdio.h> -int main() -{ - // testing number - int num, len = -13 /* here minus 13 because we will remove the massage characters in line 10 */; - printf("Enter a number to get the length : "); - scanf("%d", &num); - len += printf("Your input : %d", num); // here the "Your input : ", this 13 characters are extra - printf("\nLength : %d", len); - - // testing char - char a[20]; - len = -13; - while (getchar() != '\n') - ; - printf("\nEnter a word to get the length : "); - scanf("%19s", &a); - len += printf("Your input : %s", a); // here the "Your input : ", this 13 characters are extra - printf("\nLength : %d", len); - return 0; -} -``` diff --git a/docs/semester_1/khurapati-idea/KI002.md b/docs/semester_1/khurapati-idea/KI002.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> KI002.c' -description: 'Plan - checking for edge case' -source: 'semester_1/khurapati-idea/KI002.c' ---- - -# KI002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Plan - checking for edge case -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/khurapati-idea/KI002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/khurapati-idea/KI002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [KI002.c] -#include <stdio.h> -int main() -{ - printf("Starting.....\n"); - - for (int i = 1; ; i++) - { - printf("i = %d\n", i); - } - return 0; -} -``` diff --git a/docs/semester_1/khurapati-idea/KI003.md b/docs/semester_1/khurapati-idea/KI003.md @@ -1,249 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> KI003.c' -description: 'Bubble sort (with swap)' -source: 'semester_1/khurapati-idea/KI003.c' ---- - -# KI003.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 24 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Bubble sort (with swap) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/khurapati-idea/KI003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/khurapati-idea/KI003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [KI003.c] -#include <stdio.h> -#include <stdlib.h> -#include <stdbool.h> - -void inputarr(int **, int); -void display(int[], int); -int asort(int *, int); -int dsort(int *, int); - -int main() -{ - int *arr = NULL, n, choice; - do - { - printf("\nEnter element count: "); - if (scanf("%d", &n) != 1 || n < 1) - { - printf("\nERROR: Invalid element count!!! Try again..."); - } - else - { - break; - } - } while (true); - inputarr(&arr, n); - - while (true) - { - printf("\n1. Sort in Ascending Order." - "\n2. Sort in Descending Order" - "\n3. Change Input" - "\n0. Exit" - "\nYour choice: "); - do - { - if (scanf("%d", &choice) != 1) - { - printf("\nInvalid Choice!!! Try again..."); - while (getchar() != '\n') - ; - } - else - { - break; - } - } while (true); - - switch (choice) - { - case 1: - printf("\n === Selected Mode: Ascending Order ===\n"); - if (!asort(arr, n)) - { - printf("\nElements are already sorted.\n"); - display(arr, n); - } - printf("\n"); - break; - case 2: - printf("\n === Selected Mode: Descending Order ===\n"); - if (!dsort(arr, n)) - { - printf("\nElements are already sorted.\n"); - display(arr, n); - } - printf("\n"); - break; - case 3: - do - { - printf("\nEnter element count: "); - if (scanf("%d", &n) != 1 || n < 1) - { - printf("\nERROR: Invalid element count!!! Try again..."); - } - else - { - break; - } - } while (true); - free(arr); - inputarr(&arr, n); - break; - case 0: - printf("\nExiting Program...\n"); - free(arr); - return 0; - default: - printf("\nInvalid Choice!!! Try again..."); - } - } -} - -void inputarr(int **arr, int n) -{ - int i; - if (n < 1) - { - printf("\nInvalid element number."); - return; - } - *arr = (int *)malloc(n * sizeof(int)); - if (*arr == NULL) - { - printf("\nERROR: Memory Allocation falied.\nExiting Program...\n"); - exit(1); - } - for (i = 0; i < n; i++) - { - printf("Enter Element %d: ", i + 1); - scanf("%d", &((*arr)[i])); - } -} - -void display(int arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i != n - 1) - { - printf(", "); - } - } - printf("]"); -} - -int asort(int *arr, int n) -{ - bool isSwaped = true; - int i, j, tempNum, swapCount = 0; - int *temp = (int *)malloc(n * sizeof(int)); - if (temp == NULL) - { - printf("\nERROR: Memory Allocation falied.\nExiting Program...\n"); - free(arr); - exit(1); - } - for (i = 0; i < n; i++) - { - temp[i] = *(arr + i); - } - for (i = 0; i < n - 1 && isSwaped == true; i++) - { - isSwaped = false; - for (j = 0; j < n - i - 1; j++) - { - if (temp[j] > temp[j + 1]) - { - tempNum = temp[j]; - temp[j] = temp[j + 1]; - temp[j + 1] = tempNum; - isSwaped = true; - swapCount++; - } - } - } - if (swapCount > 0) - { - display(temp, n); - } - free(temp); - return swapCount; -} - -int dsort(int *arr, int n) -{ - bool isSwaped = true; - int i, j, tempNum, swapCount = 0; - int *temp = (int *)malloc(n * sizeof(int)); - if (temp == NULL) - { - printf("\nERROR: Memory Allocation falied.\nExiting Program...\n"); - free(arr); - exit(1); - } - for (i = 0; i < n; i++) - { - temp[i] = *(arr + i); - } - for (i = 0; i < n - 1 && isSwaped == true; i++) - { - isSwaped = false; - for (j = 0; j < n - i - 1; j++) - { - if (temp[j] < temp[j + 1]) - { - tempNum = temp[j]; - temp[j] = temp[j + 1]; - temp[j + 1] = tempNum; - isSwaped = true; - swapCount++; - } - } - } - if (swapCount > 0) - { - display(temp, n); - } - free(temp); - return swapCount; -} -``` diff --git a/docs/semester_1/khurapati-idea/KI004.md b/docs/semester_1/khurapati-idea/KI004.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> KI004.c' -description: 'Trying to write code only with emoji' -source: 'semester_1/khurapati-idea/KI004.c' ---- - -# KI004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 27 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Trying to write code only with emoji -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/khurapati-idea/KI004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/khurapati-idea/KI004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [KI004.c] -#include<stdio.h> - -#define 😒 int -#define 😊 main -#define 😂 ( -#define 🤣 ) -#define ❤️ printf -#define 😍 ; -#define 🙌 return -#define 👍 scanf -#define 😁 " -#define 👌 { -#define 😘 } - -😒 😊😂🤣👌 - 😒 num😍 - ❤️😂😁Enter the number: 😁🤣😍 - 👍😂😁%d😁, &num🤣😍 - ❤️😂😁Entered number: %d😁, num🤣😍 - 🙌 0😍 -😘 -``` diff --git a/docs/semester_1/khurapati-idea/index.md b/docs/semester_1/khurapati-idea/index.md @@ -1,14 +0,0 @@ -# Khurapati Idea - -Files and sub-folders in **Khurapati Idea**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `KI001.c` | [View Code](KI001.md) | -| 2 | `KI002.c` | [View Code](KI002.md) | -| 3 | `KI003.c` | [View Code](KI003.md) | -| 4 | `KI004.c` | [View Code](KI004.md) | -| 5 | `interpeter.py` | [View Code](interpeter.md) | - diff --git a/docs/semester_1/khurapati-idea/interpeter.md b/docs/semester_1/khurapati-idea/interpeter.md @@ -1,123 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> interpeter.py' -description: 'Python program — interpeter.py' -source: 'semester_1/khurapati-idea/interpeter.py' ---- - -# interpeter.py - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 06 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/khurapati-idea/interpeter.py" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/khurapati-idea/interpeter.py" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```python [interpeter.py] -# Author : Amit Dutta <amitdutta4255@gmail.com> -# Date : 06 Feb 2026 -# Repo : https://github.com/notamitgamer/bsc -# License : MIT License (See the LICENSE file for details) -# Copyright (c) 2026 Amit Dutta - -import sys -import os -import subprocess -import re - -# Set the absolute path to your GCC compiler based on your system logs -COMPILER_PATH = r"G:\bsc\MinGW64\bin\gcc.exe" - -def run_universal_compiler(): - if len(sys.argv) < 2: - print("Usage: python emojic.py <file.c>") - sys.exit(1) - - source_path = sys.argv[1] - if not os.path.exists(source_path): - print(f"File not found: {source_path}") - sys.exit(1) - - with open(source_path, 'r', encoding='utf-8') as f: - content = f.read() - - mapping = {} - # Extract emoji mappings from #define statements - define_pattern = re.compile(r'#define\s+(\S+)\s+(.+)') - - lines = content.splitlines() - code_lines = [] - - for line in lines: - match = define_pattern.match(line.strip()) - if match: - emoji_key = match.group(1) - c_value = match.group(2).strip() - mapping[emoji_key] = c_value - else: - code_lines.append(line) - - translated_code = "\n".join(code_lines) - - # Sort keys by length descending to replace multi-emoji tokens correctly - sorted_keys = sorted(mapping.keys(), key=len, reverse=True) - - for key in sorted_keys: - translated_code = translated_code.replace(key, mapping[key]) - - # Ensure standard header is present if logic needs it - header = "#include <stdio.h>\n" - if "#include" not in translated_code: - translated_code = header + translated_code - - temp_file = "output_target.c" - with open(temp_file, "w", encoding="utf-8") as f: - f.write(translated_code) - - exe_name = source_path.rsplit('.', 1)[0] + ".exe" - compile_cmd = [COMPILER_PATH, temp_file, "-o", exe_name] - - try: - # Use shell=True for better command resolution on Windows - result = subprocess.run(compile_cmd, capture_output=True, text=True, shell=(os.name == 'nt')) - - if result.returncode == 0: - print(f"Compilation Successful: {exe_name}") - run_cmd = [f".\\{exe_name}"] if os.name == 'nt' else [f"./{exe_name}"] - subprocess.run(run_cmd, shell=(os.name == 'nt')) - else: - print("Compilation Error:") - print(result.stderr) - - except FileNotFoundError: - print(f"Error: Compiler '{COMPILER_PATH}' not found.") - print("Please ensure GCC is installed and added to your PATH,") - print("or edit COMPILER_PATH in this script to point to your gcc.exe.") - - if os.path.exists(temp_file): - os.remove(temp_file) - -if __name__ == "__main__": - run_universal_compiler() -``` diff --git a/docs/semester_1/letusc/index.md b/docs/semester_1/letusc/index.md @@ -1,149 +0,0 @@ -# Letusc - -Files and sub-folders in **Letusc**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `luc001.c` | [View Code](luc001.md) | -| 2 | `luc002.c` | [View Code](luc002.md) | -| 3 | `luc003.c` | [View Code](luc003.md) | -| 4 | `luc004.c` | [View Code](luc004.md) | -| 5 | `luc005.c` | [View Code](luc005.md) | -| 6 | `luc006.c` | [View Code](luc006.md) | -| 7 | `luc007.c` | [View Code](luc007.md) | -| 8 | `luc008.c` | [View Code](luc008.md) | -| 9 | `luc009.c` | [View Code](luc009.md) | -| 10 | `luc010.c` | [View Code](luc010.md) | -| 11 | `luc011.c` | [View Code](luc011.md) | -| 12 | `luc012.c` | [View Code](luc012.md) | -| 13 | `luc013.c` | [View Code](luc013.md) | -| 14 | `luc014.c` | [View Code](luc014.md) | -| 15 | `luc015.c` | [View Code](luc015.md) | -| 16 | `luc016.c` | [View Code](luc016.md) | -| 17 | `luc017.c` | [View Code](luc017.md) | -| 18 | `luc018-logic.c` | [View Code](luc018-logic.md) | -| 19 | `luc018.c` | [View Code](luc018.md) | -| 20 | `luc019.c` | [View Code](luc019.md) | -| 21 | `luc020.c` | [View Code](luc020.md) | -| 22 | `luc021.c` | [View Code](luc021.md) | -| 23 | `luc022.c` | [View Code](luc022.md) | -| 24 | `luc023.c` | [View Code](luc023.md) | -| 25 | `luc024.c` | [View Code](luc024.md) | -| 26 | `luc025.c` | [View Code](luc025.md) | -| 27 | `luc026.c` | [View Code](luc026.md) | -| 28 | `luc027.c` | [View Code](luc027.md) | -| 29 | `luc028.c` | [View Code](luc028.md) | -| 30 | `luc029.c` | [View Code](luc029.md) | -| 31 | `luc030.c` | [View Code](luc030.md) | -| 32 | `luc031-logic.c` | [View Code](luc031-logic.md) | -| 33 | `luc031.c` | [View Code](luc031.md) | -| 34 | `luc032.c` | [View Code](luc032.md) | -| 35 | `luc033.c` | [View Code](luc033.md) | -| 36 | `luc034.c` | [View Code](luc034.md) | -| 37 | `luc035.c` | [View Code](luc035.md) | -| 38 | `luc036.c` | [View Code](luc036.md) | -| 39 | `luc037.c` | [View Code](luc037.md) | -| 40 | `luc038.c` | [View Code](luc038.md) | -| 41 | `luc039.c` | [View Code](luc039.md) | -| 42 | `luc040-logic.c` | [View Code](luc040-logic.md) | -| 43 | `luc040.c` | [View Code](luc040.md) | -| 44 | `luc041.c` | [View Code](luc041.md) | -| 45 | `luc042.c` | [View Code](luc042.md) | -| 46 | `luc043.c` | [View Code](luc043.md) | -| 47 | `luc044.c` | [View Code](luc044.md) | -| 48 | `luc045.c` | [View Code](luc045.md) | -| 49 | `luc046.c` | [View Code](luc046.md) | -| 50 | `luc047.c` | [View Code](luc047.md) | -| 51 | `luc048.c` | [View Code](luc048.md) | -| 52 | `luc049.c` | [View Code](luc049.md) | -| 53 | `luc050.c` | [View Code](luc050.md) | -| 54 | `luc051.c` | [View Code](luc051.md) | -| 55 | `luc052.c` | [View Code](luc052.md) | -| 56 | `luc053.c` | [View Code](luc053.md) | -| 57 | `luc054.c` | [View Code](luc054.md) | -| 58 | `luc055.c` | [View Code](luc055.md) | -| 59 | `luc056.c` | [View Code](luc056.md) | -| 60 | `luc057.c` | [View Code](luc057.md) | -| 61 | `luc058.c` | [View Code](luc058.md) | -| 62 | `luc059.c` | [View Code](luc059.md) | -| 63 | `luc060.c` | [View Code](luc060.md) | -| 64 | `luc061.c` | [View Code](luc061.md) | -| 65 | `luc062.c` | [View Code](luc062.md) | -| 66 | `luc063.c` | [View Code](luc063.md) | -| 67 | `luc064.c` | [View Code](luc064.md) | -| 68 | `luc065.c` | [View Code](luc065.md) | -| 69 | `luc066.c` | [View Code](luc066.md) | -| 70 | `luc067.c` | [View Code](luc067.md) | -| 71 | `luc068.c` | [View Code](luc068.md) | -| 72 | `luc069.c` | [View Code](luc069.md) | -| 73 | `luc070.c` | [View Code](luc070.md) | -| 74 | `luc071.c` | [View Code](luc071.md) | -| 75 | `luc072.c` | [View Code](luc072.md) | -| 76 | `luc073.c` | [View Code](luc073.md) | -| 77 | `luc074.c` | [View Code](luc074.md) | -| 78 | `luc075.c` | [View Code](luc075.md) | -| 79 | `luc076.c` | [View Code](luc076.md) | -| 80 | `luc077.c` | [View Code](luc077.md) | -| 81 | `luc078.c` | [View Code](luc078.md) | -| 82 | `luc079.c` | [View Code](luc079.md) | -| 83 | `luc080.c` | [View Code](luc080.md) | -| 84 | `luc081.c` | [View Code](luc081.md) | -| 85 | `luc082.c` | [View Code](luc082.md) | -| 86 | `luc083.c` | [View Code](luc083.md) | -| 87 | `luc084.c` | [View Code](luc084.md) | -| 88 | `luc085.c` | [View Code](luc085.md) | -| 89 | `luc086.c` | [View Code](luc086.md) | -| 90 | `luc087.c` | [View Code](luc087.md) | -| 91 | `luc088.c` | [View Code](luc088.md) | -| 92 | `luc089.c` | [View Code](luc089.md) | -| 93 | `luc090.c` | [View Code](luc090.md) | -| 94 | `luc091.c` | [View Code](luc091.md) | -| 95 | `luc092.c` | [View Code](luc092.md) | -| 96 | `luc093.c` | [View Code](luc093.md) | -| 97 | `luc094.c` | [View Code](luc094.md) | -| 98 | `luc095.c` | [View Code](luc095.md) | -| 99 | `luc096.c` | [View Code](luc096.md) | -| 100 | `luc097.c` | [View Code](luc097.md) | -| 101 | `luc098.c` | [View Code](luc098.md) | -| 102 | `luc099.c` | [View Code](luc099.md) | -| 103 | `luc100.c` | [View Code](luc100.md) | -| 104 | `luc101.c` | [View Code](luc101.md) | -| 105 | `luc102.c` | [View Code](luc102.md) | -| 106 | `luc103.c` | [View Code](luc103.md) | -| 107 | `luc104.c` | [View Code](luc104.md) | -| 108 | `luc105.c` | [View Code](luc105.md) | -| 109 | `luc106.c` | [View Code](luc106.md) | -| 110 | `luc107.c` | [View Code](luc107.md) | -| 111 | `luc108.c` | [View Code](luc108.md) | -| 112 | `luc109.c` | [View Code](luc109.md) | -| 113 | `luc110.c` | [View Code](luc110.md) | -| 114 | `luc111.c` | [View Code](luc111.md) | -| 115 | `luc112.c` | [View Code](luc112.md) | -| 116 | `luc113.c` | [View Code](luc113.md) | -| 117 | `luc114.c` | [View Code](luc114.md) | -| 118 | `luc115.c` | [View Code](luc115.md) | -| 119 | `luc116.c` | [View Code](luc116.md) | -| 120 | `luc117.c` | [View Code](luc117.md) | -| 121 | `luc118.c` | [View Code](luc118.md) | -| 122 | `luc119.c` | [View Code](luc119.md) | -| 123 | `lucproblem001.c` | [View Code](lucproblem001.md) | -| 124 | `lucproblem002.c` | [View Code](lucproblem002.md) | -| 125 | `lucproblem003.c` | [View Code](lucproblem003.md) | -| 126 | `lucproblem004.c` | [View Code](lucproblem004.md) | -| 127 | `lucproblem005.c` | [View Code](lucproblem005.md) | -| 128 | `lucproblem006.c` | [View Code](lucproblem006.md) | -| 129 | `lucproblem007.c` | [View Code](lucproblem007.md) | -| 130 | `lucproblem008.c` | [View Code](lucproblem008.md) | -| 131 | `lucproblem009.c` | [View Code](lucproblem009.md) | -| 132 | `lucproblem010-complex.c` | [View Code](lucproblem010-complex.md) | -| 133 | `lucproblem010.c` | [View Code](lucproblem010.md) | -| 134 | `lucproblem011.c` | [View Code](lucproblem011.md) | -| 135 | `lucproblem012.c` | [View Code](lucproblem012.md) | -| 136 | `lucproblem013.c` | [View Code](lucproblem013.md) | -| 137 | `lucproblem014-short.c` | [View Code](lucproblem014-short.md) | -| 138 | `lucproblem014.c` | [View Code](lucproblem014.md) | -| 139 | `lucproblem015.c` | [View Code](lucproblem015.md) | -| 140 | `lucproblem016.c` | [View Code](lucproblem016.md) | - diff --git a/docs/semester_1/letusc/luc001.md b/docs/semester_1/letusc/luc001.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc001.c' -description: 'Temperature of a city in fahrenheit degrees is input through the keyboard. WAP to convert this temperature into Centigrade degrees.' -source: 'semester_1/letusc/luc001.c' ---- - -# luc001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Temperature of a city in fahrenheit degrees is input through the keyboard. WAP to convert this temperature into Centigrade degrees. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc001.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc002.md b/docs/semester_1/letusc/luc002.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc002.c' -description: '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.' -source: 'semester_1/letusc/luc002.c' ---- - -# luc002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc002.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc003.md b/docs/semester_1/letusc/luc003.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc003.c' -description: '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.' -source: 'semester_1/letusc/luc003.c' ---- - -# luc003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc003.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; -} -``` diff --git a/docs/semester_1/letusc/luc004.md b/docs/semester_1/letusc/luc004.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc004.c' -description: '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 %)' -source: 'semester_1/letusc/luc004.c' ---- - -# luc004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 %) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc004.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc005.md b/docs/semester_1/letusc/luc005.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc005.c' -description: '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)' -source: 'semester_1/letusc/luc005.c' ---- - -# luc005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc005.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc006.md b/docs/semester_1/letusc/luc006.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc006.c' -description: '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))' -source: 'semester_1/letusc/luc006.c' ---- - -# luc006.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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)) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc006.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; -} -``` diff --git a/docs/semester_1/letusc/luc007.md b/docs/semester_1/letusc/luc007.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc007.c' -description: '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).' -source: 'semester_1/letusc/luc007.c' ---- - -# luc007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc007.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc008.md b/docs/semester_1/letusc/luc008.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc008.c' -description: 'If value of an angle is input through the keyboard, write a program to print all its trigonometric ratios.' -source: 'semester_1/letusc/luc008.c' ---- - -# luc008.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -If value of an angle is input through the keyboard, write a program to print all its trigonometric ratios. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc008.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc009.md b/docs/semester_1/letusc/luc009.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc009.c' -description: 'Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.' -source: 'semester_1/letusc/luc009.c' ---- - -# luc009.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc009.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc010.md b/docs/semester_1/letusc/luc010.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc010.c' -description: '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.' -source: 'semester_1/letusc/luc010.c' ---- - -# luc010.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc010.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc011.md b/docs/semester_1/letusc/luc011.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc011.c' -description: 'If ages of Ram, Shyam and Ajay are input through the keyboard, write a program to determine the youngest of the three.' -source: 'semester_1/letusc/luc011.c' ---- - -# luc011.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -If ages of Ram, Shyam and Ajay are input through the keyboard, write a program to determine the youngest of the three. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc011.c] -#include <stdio.h> -int main() -{ - int ram, shyam, ajay; - printf("Please enter the age of Ram, Shyam and Ajay : "); - scanf("%d %d %d", &ram, ­am, &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; -} -``` diff --git a/docs/semester_1/letusc/luc012.md b/docs/semester_1/letusc/luc012.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc012.c' -description: '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.' -source: 'semester_1/letusc/luc012.c' ---- - -# luc012.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc012.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; -} -``` diff --git a/docs/semester_1/letusc/luc013.md b/docs/semester_1/letusc/luc013.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc013.c' -description: 'Write a program to find the absolute value of a number entered through the keyboard.' -source: 'semester_1/letusc/luc013.c' ---- - -# luc013.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the absolute value of a number entered through the keyboard. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc013.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc014.md b/docs/semester_1/letusc/luc014.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc014.c' -description: '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.' -source: 'semester_1/letusc/luc014.c' ---- - -# luc014.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc014.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc015.md b/docs/semester_1/letusc/luc015.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc015.c' -description: 'Given three points (x1, y1), (x2, y2), and (x3, y3), write a program to check if the three poins fall on one straight line.' -source: 'semester_1/letusc/luc015.c' ---- - -# luc015.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Given three points (x1, y1), (x2, y2), and (x3, y3), write a program to check if the three poins fall on one straight line. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc015.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc016.md b/docs/semester_1/letusc/luc016.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc016.c' -description: '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.)' -source: 'semester_1/letusc/luc016.c' ---- - -# luc016.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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.) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc016.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc017.md b/docs/semester_1/letusc/luc017.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc017.c' -description: 'Given a point (x, y), write a program to find out if it lies on X-axis, Y-axis or origin.' -source: 'semester_1/letusc/luc017.c' ---- - -# luc017.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Given a point (x, y), write a program to find out if it lies on X-axis, Y-axis or origin. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc017.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc018-logic.md b/docs/semester_1/letusc/luc018-logic.md @@ -1,127 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc018-logic.c' -description: '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.' -source: 'semester_1/letusc/luc018-logic.c' ---- - -# luc018-logic.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc018-logic.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc018-logic.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc018-logic.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc018.md b/docs/semester_1/letusc/luc018.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc018.c' -description: '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.' -source: 'semester_1/letusc/luc018.c' ---- - -# luc018.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc018.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc018.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc018.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc019.md b/docs/semester_1/letusc/luc019.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc019.c' -description: '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.' -source: 'semester_1/letusc/luc019.c' ---- - -# luc019.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc019.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc019.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc019.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc020.md b/docs/semester_1/letusc/luc020.md @@ -1,94 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc020.c' -description: '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.' -source: 'semester_1/letusc/luc020.c' ---- - -# luc020.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc020.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc020.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc020.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc021.md b/docs/semester_1/letusc/luc021.md @@ -1,94 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc021.c' -description: '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.' -source: 'semester_1/letusc/luc021.c' ---- - -# luc021.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc021.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc021.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc021.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. */ -``` diff --git a/docs/semester_1/letusc/luc022.md b/docs/semester_1/letusc/luc022.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc022.c' -description: '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' -source: 'semester_1/letusc/luc022.c' ---- - -# luc022.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc022.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc022.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc022.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc023.md b/docs/semester_1/letusc/luc023.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc023.c' -description: '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.' -source: 'semester_1/letusc/luc023.c' ---- - -# luc023.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc023.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc023.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc023.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc024.md b/docs/semester_1/letusc/luc024.md @@ -1,54 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc024.c' -description: 'Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not.' -source: 'semester_1/letusc/luc024.c' ---- - -# luc024.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc024.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc024.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc024.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc025.md b/docs/semester_1/letusc/luc025.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc025.c' -description: 'Write a program to find the greates of the three numbers entered through the keyboard. Use conditional operators.' -source: 'semester_1/letusc/luc025.c' ---- - -# luc025.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the greates of the three numbers entered through the keyboard. Use conditional operators. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc025.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc025.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc025.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; -} -``` diff --git a/docs/semester_1/letusc/luc026.md b/docs/semester_1/letusc/luc026.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc026.c' -description: '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.' -source: 'semester_1/letusc/luc026.c' ---- - -# luc026.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc026.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc026.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc026.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc027.md b/docs/semester_1/letusc/luc027.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc027.c' -description: 'C program — luc027.c' -source: 'semester_1/letusc/luc027.c' ---- - -# luc027.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc027.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc027.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc027.c] -#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; - } -*/ -/* 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; -} -``` diff --git a/docs/semester_1/letusc/luc028.md b/docs/semester_1/letusc/luc028.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc028.c' -description: '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.' -source: 'semester_1/letusc/luc028.c' ---- - -# luc028.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc028.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc028.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc028.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc029.md b/docs/semester_1/letusc/luc029.md @@ -1,67 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc029.c' -description: '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)' -source: 'semester_1/letusc/luc029.c' ---- - -# luc029.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc029.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc029.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc029.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc030.md b/docs/semester_1/letusc/luc030.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc030.c' -description: '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.' -source: 'semester_1/letusc/luc030.c' ---- - -# luc030.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc030.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc030.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc030.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc031-logic.md b/docs/semester_1/letusc/luc031-logic.md @@ -1,121 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc031-logic.c' -description: 'Write a program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered.' -source: 'semester_1/letusc/luc031-logic.c' ---- - -# luc031-logic.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc031-logic.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc031-logic.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc031-logic.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc031.md b/docs/semester_1/letusc/luc031.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc031.c' -description: 'Write a program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered.' -source: 'semester_1/letusc/luc031.c' ---- - -# luc031.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc031.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc031.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc031.c] -#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"); -} -``` diff --git a/docs/semester_1/letusc/luc032.md b/docs/semester_1/letusc/luc032.md @@ -1,67 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc032.c' -description: '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.)' -source: 'semester_1/letusc/luc032.c' ---- - -# luc032.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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.) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc032.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc032.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc032.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc033.md b/docs/semester_1/letusc/luc033.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc033.c' -description: '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.' -source: 'semester_1/letusc/luc033.c' ---- - -# luc033.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc033.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc033.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc033.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/luc034.md b/docs/semester_1/letusc/luc034.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc034.c' -description: 'Write a program to print the multiplication table of the number entered by the user. The table should get displayed in the following form : 29 * 1 = 29 29 * 2 = 58' -source: 'semester_1/letusc/luc034.c' ---- - -# luc034.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to print the multiplication table of the number entered by the user. The table should get displayed in the following form : 29 * 1 = 29 29 * 2 = 58 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc034.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc034.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc034.c] -#include <stdio.h> -int main() -{ - int i, num, res; - printf("Enter the number : "); - scanf("%d", &num); - printf("\n--- Multiplication Table ---\n"); - for (i = 1; i <= 10; i++) - printf("%d * %d = %d\n", num, i, num * i); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc035.md b/docs/semester_1/letusc/luc035.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc035.c' -description: 'According to a study, the approximate level of intelligence of a person can be calculated using the following formula. i = 2 + (y + 0.5x) write a program that will produce a table of values of i, y and x, where y varies from 1 to 6, and, for each value of y, x varies from 5.5 to 12.5 in steps of 0.5' -source: 'semester_1/letusc/luc035.c' ---- - -# luc035.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -According to a study, the approximate level of intelligence of a person can be calculated using the following formula. i = 2 + (y + 0.5x) write a program that will produce a table of values of i, y and x, where y varies from 1 to 6, and, for each value of y, x varies from 5.5 to 12.5 in steps of 0.5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc035.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc035.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc035.c] -#include <stdio.h> -int main() -{ - double y, x; - printf("\n--- Approximate Intelligence ---\n"); - for (y = 1; y <= 6; y++) - { - printf("\tY = %d\n", y); - for (x = 5.5; x <= 12.5; x += 0.5) - { - printf("Y: %g\t X: %.2g\t I: %g\n", y, x, 2 + (y + 0.5 * x)); - } - printf("-----------------------\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc036.md b/docs/semester_1/letusc/luc036.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc036.c' -description: 'When interest compounds q times per year at an annual rate of r % for n years, the principle p compounds to an amount a as per the following formula a = p (1 + r / q) ^ nq Write a program to read 10 sets of p, r, n & q and calculate the corresponding as''' -source: 'semester_1/letusc/luc036.c' ---- - -# luc036.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -When interest compounds q times per year at an annual rate of r % for n years, the principle p compounds to an amount a as per the following formula a = p (1 + r / q) ^ nq Write a program to read 10 sets of p, r, n & q and calculate the corresponding as' -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc036.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc036.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc036.c] -#include <stdio.h> -#include <math.h> -int main() -{ - double interest, principalAmount, interestRate, timeInYears, compoundFactor, totalAmount; - int index; - for (index = 1; index <= 10; index++) - { - printf("Enter Principle amount : "); - scanf("%lf", &principalAmount); - printf("Enter Rate of Interest : "); - scanf("%lf", &interestRate); - interestRate *= 0.01; - printf("Enter the Time (Years) : "); - scanf("%lf", &timeInYears); - printf("Compound count in one year : "); - scanf("%lf", &compoundFactor); - totalAmount = (principalAmount * pow((1 + interestRate / compoundFactor), (timeInYears * compoundFactor))); - interest = totalAmount - principalAmount; - printf("\nInterest : %.2f\nTotal Amount : %.2f\n\n", interest, totalAmount); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc037.md b/docs/semester_1/letusc/luc037.md @@ -1,67 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc037.c' -description: 'The natural logarithm can be approximated by the following series. (x-1)/x + 1/2 ((x-1)/x)^2 + 1/2 ((x-1)/x)^3 + 1/2 ((x-1)/x)^4 + ... If x is input through the keyboard, write a program to calculate the sum of the first seven terms of this series.' -source: 'semester_1/letusc/luc037.c' ---- - -# luc037.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -The natural logarithm can be approximated by the following series. (x-1)/x + 1/2 ((x-1)/x)^2 + 1/2 ((x-1)/x)^3 + 1/2 ((x-1)/x)^4 + ... If x is input through the keyboard, write a program to calculate the sum of the first seven terms of this series. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc037.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc037.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc037.c] -#include <stdio.h> -#include <math.h> - -double series(double x) // made this fn only for fun, making a fn was not necessary -{ - double result = (x - 1) / x; - int i; - for (i = 2; i <= 7; i++) - { - result += 0.5 * pow(((x - 1) / x), i); - } - return result; -} - -int main() -{ - double x; - printf("Enter the value for x : "); - scanf("%lf", &x); - printf("\nResult : %g", series(x)); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc038.md b/docs/semester_1/letusc/luc038.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc038.c' -description: 'Write a program to generate all Pythagorean Triplets with slide length less than or equal to 30.' -source: 'semester_1/letusc/luc038.c' ---- - -# luc038.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to generate all Pythagorean Triplets with slide length less than or equal to 30. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc038.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc038.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc038.c] -#include <stdio.h> -#include <math.h> - -int main() -{ - int a, b, c; - printf("Pythagorean Triplets with slide length less than or equal to 30 : \n"); - for (a = 1; a <= 30; a++) - { - for (b = a; b <= 30; b++) - { - int c_square = a * a + b * b; - for (c = b + 1; c <= 30; c++) - { - if (c * c == c_square) - printf("(%d, %d, %d)\n", a, b, c); - } - } - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc039.md b/docs/semester_1/letusc/luc039.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc039.c' -description: 'Population of a town today is 100000. The population has increased steadily at the rate of 10% per year for last 10 years. Write a program to determine the population at the end of each year in the last decade.' -source: 'semester_1/letusc/luc039.c' ---- - -# luc039.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Population of a town today is 100000. The population has increased steadily at the rate of 10% per year for last 10 years. Write a program to determine the population at the end of each year in the last decade. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc039.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc039.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc039.c] -#include <stdio.h> -int main() -{ - int i, population = 100000; - printf("Present year : %d\n", population); - for (i = 1; i <= 10; i++) - { - population /= 1.10; - printf("%d year ago : %d\n", i, population); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc040-logic.md b/docs/semester_1/letusc/luc040-logic.md @@ -1,164 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc040-logic.c' -description: 'Ramanujan number (1729) is the smallest number that can be expressed as sum of cubes in two different ways - 1729 can be expressed as 1^3 + 12^3 and 9^3 + 10^3. Write a program to print all such numbers up to a reasonable limit.' -source: 'semester_1/letusc/luc040-logic.c' ---- - -# luc040-logic.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Ramanujan number (1729) is the smallest number that can be expressed as sum of cubes in two different ways - 1729 can be expressed as 1^3 + 12^3 and 9^3 + 10^3. Write a program to print all such numbers up to a reasonable limit. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc040-logic.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc040-logic.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc040-logic.c] -#include <stdio.h> // Includes the standard input/output library, necessary for printf() - -// 2. CONSTANT DEFINITIONS (MACROS) -// These define fixed values we can easily use and change later. -#define LIMIT 100000 // The maximum number we want to search up to. -// The maximum base value (a, b, c, or d) we need to check. -// Since 47^3 is greater than 100,000, checking bases up to 47 covers the LIMIT. -#define MAX_BASE_VAL 47 - -// 3. MAIN FUNCTION -int main() -{ - // 4. VARIABLE DECLARATION - - // sum1 and sum2 store the results of a^3 + b^3 and c^3 + d^3. - // We use 'long long' because cubes (like 47^3) are large and can exceed - // the capacity of a standard 'int', preventing errors. - long long sum1, sum2; - - int count = 0; // Counter to keep track of how many Ramanujan numbers we find. - - // This flag is used to optimize the search. If we find the second way (c^3 + d^3) - // to make sum1, we set this to 1 and immediately stop the inner loops. - int found_match; - - // Print introductory message to the user. - printf("Ramanujan Number Finder (a^3 + b^3 = c^3 + d^3)\n"); - printf("Searching up to %d (Max base value is %d)\n", LIMIT, MAX_BASE_VAL); - printf("---------------------------------------------------\n"); - - // 5. OUTER LOOPS: Establishing the FIRST SUM (a^3 + b^3 = sum1) - - // Loop for 'a' (the smaller base of the first pair) - for (int a = 1; a <= MAX_BASE_VAL; a++) - { - - // Loop for 'b' (the larger base of the first pair) - // We start 'b' at 'a + 1' to enforce the rule a < b. - // This prevents us from checking redundant pairs like (1, 12) and (12, 1). - for (int b = a + 1; b <= MAX_BASE_VAL; b++) - { - - // Calculate the first sum: sum1 = a^3 + b^3 - // (long long) is a cast to ensure the math is done using the 'long long' type. - sum1 = (long long)a * a * a + (long long)b * b * b; - - // Optimization 1: Check if the sum exceeds the global limit. - if (sum1 > LIMIT) - { - // Since 'b' is increasing, any further increase will also be over the limit. - // We stop the 'b' loop and move to the next 'a'. - break; - } - - // Reset the flag for every new sum1. - // We start searching for a second way for this new 'sum1', so we reset the flag to 0. - found_match = 0; - - // 6. INNER LOOPS: Searching for the SECOND SUM (c^3 + d^3 = sum2) - - // Loop for 'c' (the smaller base of the second pair) - // We start 'c' at 'a + 1' to enforce the rule a < c. - // This ensures the two pairs {(a, b) and (c, d)} are truly distinct (e.g., 1729 = 1^3 + 12^3 and 9^3 + 10^3). - for (int c = a + 1; c <= MAX_BASE_VAL; c++) - { - - // Optimization 2: Check the flag to exit the 'c' loop early. - if (found_match) - { - // If we already found the second way (c, d) in a previous iteration of 'c', stop searching and move to the next (a, b) pair. - break; - } - - // Loop for 'd' (the larger base of the second pair) - // We start 'd' at 'c + 1' to enforce c < d. - for (int d = c + 1; d <= MAX_BASE_VAL; d++) - { - - // Calculate the second sum: sum2 = c^3 + d^3 - sum2 = (long long)c * c * c + (long long)d * d * d; - - // Optimization 3: Check if the second sum has passed the first sum. - if (sum2 > sum1) - { - // Since 'd' is increasing, any further increase will also be greater than sum1. - // We stop the 'd' loop and move to the next 'c'. - break; - } - - // 7. CONDITION CHECK: Have we found a Ramanujan number? - // Check if the two sums are equal. - if (sum1 == sum2) - { - count++; // Increment the counter - - // Print the result in the required format. - printf("[%d] %lld = %d^3 + %d^3 = %d^3 + %d^3\n", - count, sum1, a, b, c, d); - - // Set the flag to 1, confirming we found the second way. - found_match = 1; - - // Stop the 'd' loop immediately, as we found the required second pair. - break; - } - } - // If found_match was set to 1, the 'break' in the d loop will execute, - // then the 'if (found_match) break;' in the c loop will execute, - // and the program will move to the next (a, b) pair. - } - } - } - - // 8. CONCLUSION - printf("---------------------------------------------------\n"); - printf("Search complete. Found %d Ramanujan-type numbers.\n", count); - - return 0; // Standard way to indicate successful program execution. -} -``` diff --git a/docs/semester_1/letusc/luc040.md b/docs/semester_1/letusc/luc040.md @@ -1,103 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc040.c' -description: 'Ramanujan number (1729) is the smallest number that can be expressed as sum of cubes in two different ways - 1729 can be expressed as 1^3 + 12^3 and 9^3 + 10^3. Write a program to print all such numbers up to a reasonable limit.' -source: 'semester_1/letusc/luc040.c' ---- - -# luc040.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Ramanujan number (1729) is the smallest number that can be expressed as sum of cubes in two different ways - 1729 can be expressed as 1^3 + 12^3 and 9^3 + 10^3. Write a program to print all such numbers up to a reasonable limit. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc040.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc040.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc040.c] -#include <stdio.h> - -#define limit 100000 -#define max_base 47 - -int main() -{ - - long long sum1, sum2; - int count = 0; - - printf("Ramanujan numbers : \n"); - - int found_match; - - for (int a = 1; a <= max_base; a++) - { - for (int b = a + 1; b <= max_base; b++) - { - sum1 = (long long)a * a * a + (long long)b * b * b; - if (sum1 > limit) - { - break; - } - - found_match = 0; - - for (int c = a + 1; c <= max_base; c++) - { - if (found_match) - { - break; - } - for (int d = c + 1; d <= max_base; d++) - { - sum2 = (long long)c * c * c + (long long)d * d * d; - if (sum2 > sum1) - { - break; - } - if (sum1 == sum2) - { - count++; - printf("(%d.) %lld = %d^3 + %d^3 = %d^3 + %d^3\n", count, sum1, a, b, c, d); - - found_match = 1; - break; - } - } - } - } - } - - printf("-------------------------------\n"); - printf("Search complete."); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc041.md b/docs/semester_1/letusc/luc041.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc041.c' -description: 'Write a program to print 24 hours of day with suitable suffixes like AM, PM, Noon and Midnight.' -source: 'semester_1/letusc/luc041.c' ---- - -# luc041.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to print 24 hours of day with suitable suffixes like AM, PM, Noon and Midnight. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc041.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc041.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc041.c] -#include <stdio.h> -int main() -{ - int hour, temp; - printf("Time \tSuffix\n"); - for (int hour = 0; hour <= 23; hour++) - { - if (hour == 0) - printf("12:00\tAM (Midnight)\n"); - else if (hour == 12) - printf("12:00\tPM (Noon)\n"); - else if (hour >= 1 && hour <= 11) - printf("%02d:00\tAM\n", hour); - else if (hour >= 13 && hour <= 23) - printf("%02d:00\tPM\n", hour - 12); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc042.md b/docs/semester_1/letusc/luc042.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc042.c' -description: 'Write a program to produce the following output : 1 2 3 4 5 6 7 8 9 10' -source: 'semester_1/letusc/luc042.c' ---- - -# luc042.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to produce the following output : 1 2 3 4 5 6 7 8 9 10 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc042.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc042.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc042.c] -#include <stdio.h> -int main() -{ - int starter = 1; - int tab = 3; - printf("The pattern : \n"); - for (int i = 1; i <= 4; i++) - { - int count = 0; - for (int k = 1; k <= tab; k++) - { - printf(" "); - } - tab = tab - 1; - for (int j = starter; j <= 10; j++) - { - if (count >= i) - { - break; - } - printf("%d ", j); - count++; - starter++; - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc043.md b/docs/semester_1/letusc/luc043.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc043.c' -description: 'Write a program to find the grace marks for a student using switch. The user should enter the class obtained by the student and the number of subjects he has failed in. Use the following logic. - If the student gets first class and he fails in more than 3 subjects, he does not get any grace, Otherwise, he gets a grace of 5 marks per subject. - If the student gets second class and he fails in more than 2 subjects, he does not get any grace. Otherwise, he gets a grace of 4 marks per subject. - If the student gets third class and he fails in more than 1 subject, then he does not get any grace. Otherwise, he gets a grace of 5 marks.' -source: 'semester_1/letusc/luc043.c' ---- - -# luc043.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the grace marks for a student using switch. The user should enter the class obtained by the student and the number of subjects he has failed in. Use the following logic. - If the student gets first class and he fails in more than 3 subjects, he does not get any grace, Otherwise, he gets a grace of 5 marks per subject. - If the student gets second class and he fails in more than 2 subjects, he does not get any grace. Otherwise, he gets a grace of 4 marks per subject. - If the student gets third class and he fails in more than 1 subject, then he does not get any grace. Otherwise, he gets a grace of 5 marks. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc043.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc043.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc043.c] -#include <stdio.h> - -int main() -{ - int studentClass, failedSubjectCount, graceMarks = 0; - printf("Class obtained by the student (Enter 1 for First Class, 2 for Second Class, 3 for Third Class): "); - scanf("%d", &studentClass); - printf("Failed Subject Count: "); - scanf("%d", &failedSubjectCount); - - if (failedSubjectCount < 0) { - printf("\nFailed subject count cannot be negative."); - return 1; - } - - switch (studentClass) - { - case 1: - if (failedSubjectCount <= 3) - { - graceMarks += 5 * failedSubjectCount; - } - break; - - case 2: - if (failedSubjectCount <= 2) - { - graceMarks += 4 * failedSubjectCount; - } - break; - - case 3: - if (failedSubjectCount <= 1) - { - graceMarks += 5 * failedSubjectCount; - } - break; - - default: - printf("\nWrong Choice."); - return 1; - } - - printf("\nStudent will get %d grace marks.", graceMarks); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc044.md b/docs/semester_1/letusc/luc044.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc044.c' -description: 'Any year is entered through the keyboard. Write a function to determine whether the year is aleap year or not.' -source: 'semester_1/letusc/luc044.c' ---- - -# luc044.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Any year is entered through the keyboard. Write a function to determine whether the year is aleap year or not. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc044.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc044.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc044.c] -#include <stdio.h> - -int leapYear(int); - -int leapYear(int year) -{ - if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) - return 1; - else - return 0; -} - -int main() -{ - int year; - printf("Enter the year : "); - scanf("%d", &year); - if (leapYear(year)) - printf("\nYear %d is a Leap Year.", year); - else - printf("\nYear %d is not a Leap Year.", year); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc045.md b/docs/semester_1/letusc/luc045.md @@ -1,100 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc045.c' -description: 'A position integer is entered through the keyboard. Write a Function to obtain the prime factors of this number. For example, prime factors of 24 are 2, 2, 2 and 3, whereas prime factors of 35 are 5 and 7' -source: 'semester_1/letusc/luc045.c' ---- - -# luc045.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -A position integer is entered through the keyboard. Write a Function to obtain the prime factors of this number. For example, prime factors of 24 are 2, 2, 2 and 3, whereas prime factors of 35 are 5 and 7 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc045.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc045.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc045.c] -#include <stdio.h> -#include <math.h> - -void findPrimeFactors(int n) -{ - int temp_n = n; - - if (temp_n == 1) - { - printf("Prime factors of %d are: None.\n", n); - return; - } - - printf("Prime factors of %d are:", n); - - while (temp_n % 2 == 0) - { - printf(" %d", 2); - temp_n = temp_n / 2; - } - - for (int i = 3; i <= (int)sqrt(temp_n); i = i + 2) - { - while (temp_n % i == 0) - { - printf(" %d", i); - temp_n = temp_n / i; - } - } - - if (temp_n > 2) - { - printf(" %d", temp_n); - } - - printf("\n"); -} - -int main() -{ - int n; - printf("Enter a positive integer to get the prime factors: "); - if (scanf("%d", &n) != 1) - { - printf("Error: Invalid input. Please enter an integer.\n"); - return 1; - } - if (n <= 0) - { - printf("Error: Please enter a POSITIVE integer.\n"); - return 1; - } - findPrimeFactors(n); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc046.md b/docs/semester_1/letusc/luc046.md @@ -1,71 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc046.c' -description: 'Given three variables x, y, z, write a function to circularly shift their values to right. In other words, if x = 5, y = 8, z = 10, after circular shift y = 5, z = 8, x = 10. cal the function with variables a, b, c to circularly shift values.' -source: 'semester_1/letusc/luc046.c' ---- - -# luc046.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Given three variables x, y, z, write a function to circularly shift their values to right. In other words, if x = 5, y = 8, z = 10, after circular shift y = 5, z = 8, x = 10. cal the function with variables a, b, c to circularly shift values. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc046.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc046.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc046.c] -#include <stdio.h> - -void circularShift(int *, int *, int *); - -int main() -{ - int x = 5, y = 8, z = 10; - - printf("--- Before Shift ---\n"); - printf("x: %d, y: %d, z: %d", x, y, z); - - circularShift(&x, &y, &z); - - printf("\n--- After Shift ---\n"); - printf("x: %d, y: %d, z: %d", x, y, z); - - return 0; -} - -void circularShift(int *x, int *y, int *z) -{ - int temp = *z; - *z = *y; - *y = *x; - *x = temp; -} -``` diff --git a/docs/semester_1/letusc/luc047.md b/docs/semester_1/letusc/luc047.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc047.c' -description: 'Define a function that receives weight of a commodity in kilograms and returns the equivalent weight in Grams, Tons and pounds. Call this fuction from main() and print the results in main()' -source: 'semester_1/letusc/luc047.c' ---- - -# luc047.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Define a function that receives weight of a commodity in kilograms and returns the equivalent weight in Grams, Tons and pounds. Call this fuction from main() and print the results in main() -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc047.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc047.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc047.c] -#include <stdio.h> - -void convertWeight(double, double *, double *, double *); - -int main() -{ - double weightGram, weightPound, weightKG, weightTON; - printf("Enter the weight of the comodity in Kilogram(s): "); - scanf("%lf", &weightKG); - - convertWeight(weightKG, &weightGram, &weightPound, &weightTON); - printf("\n%g Kilogram(s) = %.04f Gram(s)" - "\n%g Kilogram(s) = %.04f Pound(s)" - "\n%g Kilogram(s) = %.04f TON(s)", - weightKG, weightGram, weightKG, weightPound, weightKG, weightTON); - return 0; -} - -void convertWeight(double weightKG, double *weightGram, double *weightPound, double *weightTON) -{ - *weightGram = weightKG * 1000.0; - *weightPound = weightKG * 2.2046226218; - *weightTON = weightKG / 1000.0; -} -``` diff --git a/docs/semester_1/letusc/luc048.md b/docs/semester_1/letusc/luc048.md @@ -1,212 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc048.c' -description: 'Define a function to compute the distance between two points and use it to develop another function that will compute the area of the triangle whose vertices are A(x1, y1), B(x2, y2), and C(x3, y3). Use these functions to develop a function which returns a value 1 if the point (x, y) lines inside the triangle ABC, otherwise returns a value 0. Would you get any advantage if you develop these functions to work on call by reference principle?' -source: 'semester_1/letusc/luc048.c' ---- - -# luc048.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Define a function to compute the distance between two points and use it to develop another function that will compute the area of the triangle whose vertices are A(x1, y1), B(x2, y2), and C(x3, y3). Use these functions to develop a function which returns a value 1 if the point (x, y) lines inside the triangle ABC, otherwise returns a value 0. Would you get any advantage if you develop these functions to work on call by reference principle? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc048.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc048.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc048.c] -#include <stdio.h> -#include <math.h> -#include <ctype.h> -#include <stdlib.h> - -void distance(double, double, double, double, double *); -void area(double, double, double, double, double, double, double *); -int is_inside(double, double, double, double, double, double, double, double); - -int main() -{ - - // Variables - double x, y, x1, x2, y1, y2, x3, y3, result_Distance, result_Area; - char choice; - - /* ********** Requirement: 1 ********** */ - - // Calculate the length of the line segment between two points, P1(x1, y1) and P2(x2, y2). - // Function Used: distance() - - printf("--- Compute the distance between two points ---\n\n"); - printf("Enter the co-ordinates of Point 1 (Ex.: 5,6): "); - scanf("%lf,%lf", &x1, &y1); - printf("Enter the co-ordinates of Point 2 (Ex.: 3,4): "); - scanf("%lf,%lf", &x2, &y2); - - distance(x1, y1, x2, y2, &result_Distance); - printf("\nDistance between P1(%g, %g) and P2(%g, %g) = %g", - x1, y1, x2, y2, result_Distance); - - /* ********** Requirement: 2 ********** */ - - // Calculate the area of a triangle ABC using its three vertices A(x1, y1), B(x2, y2), and C(x3, y3). - // Fuction Used: distance(), area() - - printf("\n\n--- Compute the area of a triangle ABC ---\n\n"); - printf("Enter the co-ordinates of Point A (Ex.: 5,6): "); - scanf("%lf,%lf", &x1, &y1); - printf("Enter the co-ordinates of Point B (Ex.: 3,4): "); - scanf("%lf,%lf", &x2, &y2); - printf("Enter the co-ordinates of Point C (Ex.: 6,7): "); - scanf("%lf,%lf", &x3, &y3); - - area(x1, y1, x2, y2, x3, y3, &result_Area); - printf("\nArea of the A(%g, %g), B(%g, %g), C(%g, %g) = %g", - x1, y1, x2, y2, x3, y3, result_Area); - - /* ********** Requirement: 3 ********** */ - - // Check if a test point P(x, y) lies strictly inside the triangle ABC. - // Function Used: distance(), area(), is_inside() - - printf("\n\n--- Check if a test point P(x, y) lies strictly inside the triangle ABC ---\n\n"); - printf("Do you wish to use previous entered triangle?" - "\nIf Yes, type 'Y'; If No, type 'N': "); - scanf(" %c", &choice); - choice = toupper(choice); - switch (choice) - { - case 'Y': - break; - case 'N': - printf("Enter the co-ordinates of Point A (Ex.: 5,6): "); - scanf("%lf,%lf", &x1, &y1); - printf("Enter the co-ordinates of Point B (Ex.: 3,4): "); - scanf("%lf,%lf", &x2, &y2); - printf("Enter the co-ordinates of Point C (Ex.: 6,7): "); - scanf("%lf,%lf", &x3, &y3); - break; - default: - printf("\nYou entered invalid choice."); - break; - } - printf("Enter the co-ordinates of Test Point (Ex.: 3,5): "); - scanf("%lf,%lf", &x, &y); - - if (is_inside(x, y, x1, y1, x2, y2, x3, y3)) - printf("\nTest Point (%g, %g) is inside ABC.", x, y); - else - printf("\nTest Point (%g, %g) is not inside ABC.", x, y); - - /* ANSWER TO THE QUESTION: - Qn.: - Would you get any advantage if you develop these functions to - work on call by reference principle? - - Ans: - NO, there is no advantage, and moreover, that would be a disadvantage. - It introduces unnecessary dereferencing overhead for every operation, - Which is less efficient than reading the simple value copy supplied by Call by Value. - */ - - // End of Program - return 0; -} - -void distance(double x1, double y1, double x2, double y2, double *result_Distance) -{ - *result_Distance = sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)); -} - -void area(double x1, double y1, double x2, double y2, double x3, double y3, double *result_Area) -{ - double s, ab, bc, ac; - - distance(x1, y1, x2, y2, &ab); - distance(x2, y2, x3, y3, &bc); - distance(x1, y1, x3, y3, &ac); - - s = (ab + bc + ac) / 2.0; - double area_sq = s * (s - ab) * (s - bc) * (s - ac); - - if (area_sq < 0) - // Handle cases where area_sq is slightly negative due to floating-point errors - *result_Area = 0.0; - else - *result_Area = sqrt(area_sq); -} - -int is_inside(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3) -{ - double area_ABC, area_PAB, area_PBC, area_PAC; - - const double EPSILON = 0.000001; - - area(x1, y1, x2, y2, x3, y3, &area_ABC); - area(x, y, x1, y1, x2, y2, &area_PAB); - area(x, y, x2, y2, x3, y3, &area_PBC); - area(x, y, x1, y1, x3, y3, &area_PAC); - - double sum_of_sub_areas = area_PAB + area_PBC + area_PAC; - - if (fabs(area_ABC - sum_of_sub_areas) < EPSILON) - return 1; - else - return 0; -} - -/* - *************** SAMPLE OUTPUT *************** - -PS G:\bsc\letusc> ./*.exe ---- Compute the distance between two points --- - -Enter the co-ordinates of Point 1 (Ex.: 5,6): 1234.56,7890.12 -Enter the co-ordinates of Point 2 (Ex.: 3,4): 1234.56,7891.12 - -Distance between P1(1234.56, 7890.12) and P2(1234.56, 7891.12) = 1 - ---- Compute the area of a triangle ABC --- - -Enter the co-ordinates of Point A (Ex.: 5,6): 100.10,200.20 -Enter the co-ordinates of Point B (Ex.: 3,4): 105.10,200.20 -Enter the co-ordinates of Point C (Ex.: 6,7): 100.10,205.20 - -Area of the A(100.1, 200.2), B(105.1, 200.2), C(100.1, 205.2) = 12.5 - ---- Check if a test point P(x, y) lies strictly inside the triangle ABC --- - -Do you wish to use previous entered triangle? -If Yes, type 'Y'; If No, type 'N': y -Enter the co-ordinates of Test Point (Ex.: 3,5): 101.10,201.20 - -Test Point (101.1, 201.2) is inside ABC. - -*/ -``` diff --git a/docs/semester_1/letusc/luc049.md b/docs/semester_1/letusc/luc049.md @@ -1,89 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc049.c' -description: 'A positive integer is entered through the keyboard, write a function to find the binary equivalent of this number: (1) Without using recursion (2) Using recursion' -source: 'semester_1/letusc/luc049.c' ---- - -# luc049.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -A positive integer is entered through the keyboard, write a function to find the binary equivalent of this number: (1) Without using recursion (2) Using recursion -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc049.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc049.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc049.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int binary_non_rec(int); -void binary_rec(int); - -int main() -{ - int num, bin; - - printf("Enter a positive integer: "); - scanf("%d", &num); - - bin = binary_non_rec(num); - printf("Binary (Non-Recursive): %d\n", bin); - - printf("Binary (Recursive): "); - binary_rec(num); - printf("\n"); - - return 0; -} - -int binary_non_rec(int n) -{ - int rem, i = 1, bin = 0; - while (n != 0) - { - rem = n % 2; - n = n / 2; - bin = bin + rem * i; - i = i * 10; - } - return bin; -} - -void binary_rec(int n) -{ - if (n > 1) - binary_rec(n / 2); - - printf("%d", n % 2); -} -``` diff --git a/docs/semester_1/letusc/luc050.md b/docs/semester_1/letusc/luc050.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc050.c' -description: 'Write a recursive function to obtain the sum of first 25 natural numbers.' -source: 'semester_1/letusc/luc050.c' ---- - -# luc050.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a recursive function to obtain the sum of first 25 natural numbers. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc050.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc050.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc050.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int get_sum(int); - -int main() -{ - int n = 25, sum; - - sum = get_sum(n); - printf("Sum of first %d natural numbers is: %d\n", n, sum); - - return 0; -} - -int get_sum(int n) -{ - if (n == 0) - return 0; - else - return n + get_sum(n - 1); -} -``` diff --git a/docs/semester_1/letusc/luc051.md b/docs/semester_1/letusc/luc051.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc051.c' -description: 'Tower of Hanoi: Write a program to print out the sequence in which 4 disks should be moved from peg A to peg C using peg B.' -source: 'semester_1/letusc/luc051.c' ---- - -# luc051.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Tower of Hanoi: Write a program to print out the sequence in which 4 disks should be moved from peg A to peg C using peg B. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc051.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc051.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc051.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -void hanoi(int, char, char, char); - -int main() -{ - int n = 4; - - printf("Sequence of moves for %d disks:\n\n", n); - hanoi(n, 'A', 'B', 'C'); - - return 0; -} - -void hanoi(int n, char from_rod, char aux_rod, char to_rod) -{ - if (n == 1) - { - printf("Move disk 1 from rod %c to rod %c\n", from_rod, to_rod); - return; - } - hanoi(n - 1, from_rod, to_rod, aux_rod); - printf("Move disk %d from rod %c to rod %c\n", n, from_rod, to_rod); - hanoi(n - 1, aux_rod, from_rod, to_rod); -} -``` diff --git a/docs/semester_1/letusc/luc052.md b/docs/semester_1/letusc/luc052.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc052.c' -description: 'If a macro is not getting expanded as per your expectation, how will you find out how is it being expanded by the preprocessor?' -source: 'semester_1/letusc/luc052.c' ---- - -# luc052.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -If a macro is not getting expanded as per your expectation, how will you find out how is it being expanded by the preprocessor? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc052.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc052.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc052.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - printf("To see how macros are expanded, use the compiler flag '-E'.\n"); - printf("Command: gcc -E filename.c\n"); - printf("This outputs the file after preprocessing stage.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc053.md b/docs/semester_1/letusc/luc053.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc053.c' -description: 'Write macro definitions for: Mean, Absolute value, Uppercase to Lowercase, Biggest of three.' -source: 'semester_1/letusc/luc053.c' ---- - -# luc053.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write macro definitions for: Mean, Absolute value, Uppercase to Lowercase, Biggest of three. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc053.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc053.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc053.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -#define MEAN(x, y) ((x + y) / 2.0) -#define ABS(x) ((x) < 0 ? -(x) : (x)) -#define TO_LOWER(x) ((x) >= 'A' && (x) <= 'Z' ? (x) + 32 : (x)) -#define MAX(x, y, z) ((x) > (y) ? ((x) > (z) ? (x) : (z)) : ((y) > (z) ? (y) : (z))) - -int main() -{ - int a, b, c, num; - char ch; - - printf("Enter two numbers for Mean: "); - scanf("%d %d", &a, &b); - printf("Mean: %.2f\n\n", MEAN(a, b)); - - printf("Enter a number for Absolute value: "); - scanf("%d", &num); - printf("Absolute: %d\n\n", ABS(num)); - - printf("Enter an uppercase character: "); - scanf(" %c", &ch); - printf("Lowercase: %c\n\n", TO_LOWER(ch)); - - printf("Enter three numbers: "); - scanf("%d %d %d", &a, &b, &c); - printf("Biggest: %d\n", MAX(a, b, c)); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc054.md b/docs/semester_1/letusc/luc054.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc054.c' -description: 'Use ''interest.h'' macros to calculate Simple Interest and Amount.' -source: 'semester_1/letusc/luc054.c' ---- - -# luc054.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Use 'interest.h' macros to calculate Simple Interest and Amount. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc054.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc054.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc054.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -#include "interest.h" - -int main() -{ - float p, r, t, si, amt; - - printf("Enter Principal, Rate and Time: "); - scanf("%f %f %f", &p, &r, &t); - - si = SIMPLE_INTEREST(p, r, t); - amt = AMOUNT(p, si); - - printf("Simple Interest: %.2f\n", si); - printf("Total Amount: %.2f\n", amt); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc055.md b/docs/semester_1/letusc/luc055.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc055.c' -description: 'Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how many are negative, how many are even and how many odd.' -source: 'semester_1/letusc/luc055.c' ---- - -# luc055.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how many are negative, how many are even and how many odd. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc055.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc055.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc055.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - int arr[25], i; - int pos = 0, neg = 0, even = 0, odd = 0; - - printf("Enter 25 integers:\n"); - for (i = 0; i < 25; i++) - { - scanf("%d", &arr[i]); - - if (arr[i] > 0) - pos++; - else if (arr[i] < 0) - neg++; - - if (arr[i] % 2 == 0) - even++; - else - odd++; - } - - printf("\nResults:\n"); - printf("Positive: %d\n", pos); - printf("Negative: %d\n", neg); - printf("Even: %d\n", even); - printf("Odd: %d\n", odd); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc056.md b/docs/semester_1/letusc/luc056.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc056.c' -description: 'If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on.' -source: 'semester_1/letusc/luc056.c' ---- - -# luc056.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc056.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc056.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc056.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - int arr[100], n, i, symmetric = 1; - - printf("Enter number of elements (n): "); - scanf("%d", &n); - - printf("Enter %d elements: ", n); - for (i = 0; i < n; i++) - { - scanf("%d", &arr[i]); - } - - // Check symmetry - for (i = 0; i < n / 2; i++) - { - if (arr[i] != arr[n - 1 - i]) - { - symmetric = 0; - break; - } - } - - if (symmetric) - printf("\nThe array is symmetric (Palindrome).\n"); - else - printf("\nThe array is NOT symmetric.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc057.md b/docs/semester_1/letusc/luc057.md @@ -1,76 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc057.c' -description: 'Write a program using pointers to find the smallest number in an array of 25 integers.' -source: 'semester_1/letusc/luc057.c' ---- - -# luc057.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using pointers to find the smallest number in an array of 25 integers. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc057.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc057.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc057.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - int arr[25], i, min; - int *ptr; - - printf("Enter 25 integers:\n"); - for (i = 0; i < 25; i++) - { - scanf("%d", &arr[i]); - } - - ptr = arr; // Point to start of array - min = *ptr; // Initialize min with first element - - for (i = 1; i < 25; i++) - { - ptr++; // Move pointer to next element - if (*ptr < min) - { - min = *ptr; - } - } - - printf("\nSmallest number is: %d\n", min); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc058.md b/docs/semester_1/letusc/luc058.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc058.c' -description: 'Implement the Insertion Sort algorithm shown in Figure 13.3 on a set of 25 numbers.' -source: 'semester_1/letusc/luc058.c' ---- - -# luc058.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Implement the Insertion Sort algorithm shown in Figure 13.3 on a set of 25 numbers. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc058.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc058.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc058.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -void insertion_sort(int *, int); - -int main() -{ - int arr[25], i; - - printf("Enter 25 integers for Insertion Sort:\n"); - for (i = 0; i < 25; i++) - { - scanf("%d", &arr[i]); - } - - insertion_sort(arr, 25); - - printf("\nSorted Array:\n"); - for (i = 0; i < 25; i++) - { - printf("%d ", arr[i]); - } - printf("\n"); - - return 0; -} - -void insertion_sort(int *arr, int n) -{ - int i, j, key; - for (i = 1; i < n; i++) - { - key = arr[i]; - j = i - 1; - - /* Move elements of arr[0..i-1], that are greater than key, - to one position ahead of their current position */ - while (j >= 0 && arr[j] > key) - { - arr[j + 1] = arr[j]; - j = j - 1; - } - arr[j + 1] = key; - } -} -``` diff --git a/docs/semester_1/letusc/luc059.md b/docs/semester_1/letusc/luc059.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc059.c' -description: 'Write a program which initializes an integer array of 10 elements in main(), passes it to modify(), multiplies each element by 3, and prints the new array in main().' -source: 'semester_1/letusc/luc059.c' ---- - -# luc059.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program which initializes an integer array of 10 elements in main(), passes it to modify(), multiplies each element by 3, and prints the new array in main(). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc059.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc059.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc059.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -void modify(int *, int); - -int main() -{ - int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - int i; - - printf("Original Array:\n"); - for (i = 0; i < 10; i++) - printf("%d ", arr[i]); - - modify(arr, 10); - - printf("\n\nModified Array (x3):\n"); - for (i = 0; i < 10; i++) - printf("%d ", arr[i]); - printf("\n"); - - return 0; -} - -void modify(int *a, int n) -{ - int i; - for (i = 0; i < n; i++) - { - a[i] = a[i] * 3; - } -} -``` diff --git a/docs/semester_1/letusc/luc060.md b/docs/semester_1/letusc/luc060.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc060.c' -description: 'For the following set of sample data, compute the standard deviation and the mean.\nData: -6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2' -source: 'semester_1/letusc/luc060.c' ---- - -# luc060.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -For the following set of sample data, compute the standard deviation and the mean.\nData: -6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc060.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc060.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc060.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - int data[] = {-6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2}; - int n = 15, i; - double sum = 0.0, mean, std_dev = 0.0; - - // Calculate Mean - for (i = 0; i < n; i++) - { - sum += data[i]; - } - mean = sum / n; - - // Calculate Standard Deviation - for (i = 0; i < n; i++) - { - std_dev += pow(data[i] - mean, 2); - } - std_dev = sqrt(std_dev / n); - - printf("Count: %d\n", n); - printf("Mean: %.2f\n", mean); - printf("Standard Deviation: %.2f\n", std_dev); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc061.md b/docs/semester_1/letusc/luc061.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc061.c' -description: 'The area of a triangle can be computed by the sine law. Given 6 triangular pieces of land (a, b, angle), find their area and determine which is largest.' -source: 'semester_1/letusc/luc061.c' ---- - -# luc061.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -The area of a triangle can be computed by the sine law. Given 6 triangular pieces of land (a, b, angle), find their area and determine which is largest. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc061.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc061.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc061.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - // Data arrays - double a[] = {137.4, 155.2, 149.3, 160.0, 155.6, 149.7}; - double b[] = {80.9, 92.62, 97.93, 100.25, 68.95, 120.0}; - double angle[] = {0.78, 0.89, 1.35, 9.00, 1.25, 1.75}; // Assuming radians based on values < 2.0. 9.00 is treated as literal. - - double area, max_area = 0.0; - int i, max_index = -1; - - printf("Plot No.\tArea\n"); - printf("------------------------\n"); - - for (i = 0; i < 6; i++) - { - // Area = 1/2 * a * b * sin(angle) - area = 0.5 * a[i] * b[i] * sin(angle[i]); - - printf("%d\t\t%.2f\n", i + 1, area); - - if (area > max_area) - { - max_area = area; - max_index = i + 1; - } - } - - printf("\nLargest Plot is No. %d with Area: %.2f\n", max_index, max_area); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc062.md b/docs/semester_1/letusc/luc062.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc062.c' -description: 'For the following set of n data points (x, y), write a program to compute the correlation coefficient r.' -source: 'semester_1/letusc/luc062.c' ---- - -# luc062.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -For the following set of n data points (x, y), write a program to compute the correlation coefficient r. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc062.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc062.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc062.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - double x[] = {34.22, 39.87, 41.85, 43.23, 40.06, 53.29, 53.29, 54.14, 49.12, 40.71, 55.15}; - double y[] = {102.43, 100.93, 97.43, 97.81, 98.32, 98.32, 100.07, 97.08, 91.59, 94.85, 94.65}; - - int n = 11, i; - double sum_x = 0, sum_y = 0, sum_xy = 0, sum_x2 = 0, sum_y2 = 0; - double numerator, denominator, r; - - for (i = 0; i < n; i++) - { - sum_x += x[i]; - sum_y += y[i]; - sum_xy += x[i] * y[i]; - sum_x2 += x[i] * x[i]; - sum_y2 += y[i] * y[i]; - } - - numerator = (n * sum_xy) - (sum_x * sum_y); - denominator = sqrt((n * sum_x2 - sum_x * sum_x) * (n * sum_y2 - sum_y * sum_y)); - - if (denominator != 0) - r = numerator / denominator; - else - r = 0; // Avoid division by zero - - printf("Correlation coefficient (r) = %.4f\n", r); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc063.md b/docs/semester_1/letusc/luc063.md @@ -1,74 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc063.c' -description: 'The X and Y coordinates of 10 different points are entered through the keyboard. Write a program to find the distance of last point from the first point (sum of distances between consecutive points).' -source: 'semester_1/letusc/luc063.c' ---- - -# luc063.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -The X and Y coordinates of 10 different points are entered through the keyboard. Write a program to find the distance of last point from the first point (sum of distances between consecutive points). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc063.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc063.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc063.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -int main() -{ - double x[10], y[10]; - double total_distance = 0.0; - int i; - - printf("Enter coordinates (x, y) for 10 points:\n"); - for (i = 0; i < 10; i++) - { - printf("Point %d: ", i + 1); - scanf("%lf %lf", &x[i], &y[i]); - } - - // Sum of distances between consecutive points P(i) and P(i+1) - for (i = 0; i < 9; i++) - { - double dx = x[i+1] - x[i]; - double dy = y[i+1] - y[i]; - total_distance += sqrt(dx*dx + dy*dy); - } - - printf("\nTotal distance from first to last point: %.2f\n", total_distance); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc064.md b/docs/semester_1/letusc/luc064.md @@ -1,212 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc064.c' -description: 'Simulate a Dequeue (Double Ended Queue) using an array. Support: retrieve left, retrieve right, insert left, insert right. Use pointers left and right.' -source: 'semester_1/letusc/luc064.c' ---- - -# luc064.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Simulate a Dequeue (Double Ended Queue) using an array. Support: retrieve left, retrieve right, insert left, insert right. Use pointers left and right. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc064.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc064.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc064.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -#define MAX 10 - -void insert_left(int *, int *, int *, int); -void insert_right(int *, int *, int *, int); -void retrieve_left(int *, int *, int *); -void retrieve_right(int *, int *, int *); -void display(int *, int, int); - -int main() -{ - int dq[MAX]; - int left = -1, right = -1; - int choice, val; - - while (1) - { - printf("\n--- Dequeue Menu ---\n"); - printf("1. Insert Left\n2. Insert Right\n"); - printf("3. Retrieve Left\n4. Retrieve Right\n"); - printf("5. Display\n6. Exit\n"); - printf("Enter choice: "); - scanf("%d", &choice); - - switch (choice) - { - case 1: - printf("Enter value: "); - scanf("%d", &val); - insert_left(dq, &left, &right, val); - break; - case 2: - printf("Enter value: "); - scanf("%d", &val); - insert_right(dq, &left, &right, val); - break; - case 3: - retrieve_left(dq, &left, &right); - break; - case 4: - retrieve_right(dq, &left, &right); - break; - case 5: - display(dq, left, right); - break; - case 6: - exit(0); - default: - printf("Invalid choice!\n"); - } - } - return 0; -} - -void insert_left(int *dq, int *left, int *right, int val) -{ - // Check if full - if ((*left == 0 && *right == MAX - 1) || (*left == *right + 1)) - { - printf("Overflow! Dequeue is full.\n"); - return; - } - - if (*left == -1) // Initially empty - { - *left = 0; - *right = 0; - } - else if (*left == 0) // Wrap around - *left = MAX - 1; - else - (*left)--; - - dq[*left] = val; - printf("Inserted %d at Left.\n", val); -} - -void insert_right(int *dq, int *left, int *right, int val) -{ - if ((*left == 0 && *right == MAX - 1) || (*left == *right + 1)) - { - printf("Overflow! Dequeue is full.\n"); - return; - } - - if (*left == -1) // Initially empty - { - *left = 0; - *right = 0; - } - else if (*right == MAX - 1) // Wrap around - *right = 0; - else - (*right)++; - - dq[*right] = val; - printf("Inserted %d at Right.\n", val); -} - -void retrieve_left(int *dq, int *left, int *right) -{ - if (*left == -1) - { - printf("Underflow! Dequeue is empty.\n"); - return; - } - - printf("Retrieved from Left: %d\n", dq[*left]); - - if (*left == *right) // Only one element was present - { - *left = -1; - *right = -1; - } - else if (*left == MAX - 1) - *left = 0; - else - (*left)++; -} - -void retrieve_right(int *dq, int *left, int *right) -{ - if (*left == -1) - { - printf("Underflow! Dequeue is empty.\n"); - return; - } - - printf("Retrieved from Right: %d\n", dq[*right]); - - if (*left == *right) // Only one element was present - { - *left = -1; - *right = -1; - } - else if (*right == 0) - *right = MAX - 1; - else - (*right)--; -} - -void display(int *dq, int left, int right) -{ - int i; - if (left == -1) - { - printf("Dequeue is Empty\n"); - return; - } - - printf("Elements: "); - i = left; - while (1) - { - printf("%d ", dq[i]); - if (i == right) - break; - if (i == MAX - 1) - i = 0; - else - i++; - } - printf("\n"); -} -``` diff --git a/docs/semester_1/letusc/luc065.md b/docs/semester_1/letusc/luc065.md @@ -1,87 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc065.c' -description: 'Write a program to find if a square matrix is symmetric.' -source: 'semester_1/letusc/luc065.c' ---- - -# luc065.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find if a square matrix is symmetric. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc065.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc065.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc065.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int mat[10][10], n, i, j; - int is_symmetric = 1; - - printf("Enter the size of the square matrix (max 10): "); - scanf("%d", &n); - - printf("Enter elements of the %dx%d matrix:\n", n, n); - for (i = 0; i < n; i++) - { - for (j = 0; j < n; j++) - { - scanf("%d", &mat[i][j]); - } - } - - // Check for symmetry: mat[i][j] must equal mat[j][i] - for (i = 0; i < n; i++) - { - for (j = 0; j < n; j++) - { - if (mat[i][j] != mat[j][i]) - { - is_symmetric = 0; - break; - } - } - if (is_symmetric == 0) - break; - } - - if (is_symmetric) - printf("\nThe matrix is Symmetric.\n"); - else - printf("\nThe matrix is NOT Symmetric.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc066.md b/docs/semester_1/letusc/luc066.md @@ -1,87 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc066.c' -description: 'Write a program to add two 6 x 6 matrices.' -source: 'semester_1/letusc/luc066.c' ---- - -# luc066.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to add two 6 x 6 matrices. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc066.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc066.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc066.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int mat1[6][6], mat2[6][6], sum[6][6]; - int i, j; - - // Initializing matrices with some values automatically - // to avoid asking user to enter 72 numbers. - printf("Initializing two 6x6 matrices with sample data...\n"); - - for (i = 0; i < 6; i++) - { - for (j = 0; j < 6; j++) - { - mat1[i][j] = i + j; // Example data - mat2[i][j] = i * j; // Example data - } - } - - // Adding matrices - for (i = 0; i < 6; i++) - { - for (j = 0; j < 6; j++) - { - sum[i][j] = mat1[i][j] + mat2[i][j]; - } - } - - printf("\nSum of the two 6x6 matrices:\n"); - for (i = 0; i < 6; i++) - { - for (j = 0; j < 6; j++) - { - printf("%4d ", sum[i][j]); - } - printf("\n"); - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc067.md b/docs/semester_1/letusc/luc067.md @@ -1,92 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc067.c' -description: 'Write a program to multiply any two 3 x 3 matrices.' -source: 'semester_1/letusc/luc067.c' ---- - -# luc067.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to multiply any two 3 x 3 matrices. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc067.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc067.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc067.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int mat1[3][3], mat2[3][3], res[3][3]; - int i, j, k; - - printf("Enter elements of first 3x3 matrix:\n"); - for (i = 0; i < 3; i++) - for (j = 0; j < 3; j++) - scanf("%d", &mat1[i][j]); - - printf("Enter elements of second 3x3 matrix:\n"); - for (i = 0; i < 3; i++) - for (j = 0; j < 3; j++) - scanf("%d", &mat2[i][j]); - - // Initialize result matrix to 0 - for (i = 0; i < 3; i++) - for (j = 0; j < 3; j++) - res[i][j] = 0; - - // Multiplication Logic - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - for (k = 0; k < 3; k++) - { - res[i][j] += mat1[i][k] * mat2[k][j]; - } - } - } - - printf("\nResult of Multiplication:\n"); - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - printf("%4d ", res[i][j]); - } - printf("\n"); - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc068.md b/docs/semester_1/letusc/luc068.md @@ -1,106 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc068.c' -description: 'Given an array p[5], write a function to shift it circularly left by two positions. Call this function for a 4 x 5 matrix and get its rows left shifted.' -source: 'semester_1/letusc/luc068.c' ---- - -# luc068.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Given an array p[5], write a function to shift it circularly left by two positions. Call this function for a 4 x 5 matrix and get its rows left shifted. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc068.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc068.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc068.c] -#include <stdio.h> -#include <stdlib.h> - -void shift_left_two(int *p, int n); -void print_row(int *p, int n); - -int main() -{ - int mat[4][5] = { - {15, 30, 28, 19, 61}, - {1, 2, 3, 4, 5}, - {10, 20, 30, 40, 50}, - {5, 4, 3, 2, 1} - }; - int i; - - printf("Original Matrix:\n"); - for (i = 0; i < 4; i++) - print_row(mat[i], 5); - - // Apply shift to each row - for (i = 0; i < 4; i++) - { - shift_left_two(mat[i], 5); - } - - printf("\nMatrix after shifting each row left by 2:\n"); - for (i = 0; i < 4; i++) - print_row(mat[i], 5); - - return 0; -} - -void shift_left_two(int *p, int n) -{ - if (n < 2) return; // Cannot shift if less than 2 elements - - int temp1 = p[0]; - int temp2 = p[1]; - int i; - - // Shift elements left by 2 - for (i = 0; i < n - 2; i++) - { - p[i] = p[i + 2]; - } - - // Place the first two elements at the end - p[n - 2] = temp1; - p[n - 1] = temp2; -} - -void print_row(int *p, int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("%d ", p[i]); - } - printf("\n"); -} -``` diff --git a/docs/semester_1/letusc/luc069.md b/docs/semester_1/letusc/luc069.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc069.c' -description: 'If the string "Alice in wonder land" is fed to the following scanf() statement, what will be the contents of arrays str1, str2, str3 and str4?' -source: 'semester_1/letusc/luc069.c' ---- - -# luc069.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -If the string "Alice in wonder land" is fed to the following scanf() statement, what will be the contents of arrays str1, str2, str3 and str4? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc069.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc069.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc069.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -int main() -{ - char str1[20], str2[20], str3[20], str4[20]; - - printf("Enter the string 'Alice in wonder land': "); - /* scanf stops reading at the first whitespace character for %s */ - scanf("%s%s%s%s", str1, str2, str3, str4); - - printf("\nContents of arrays:\n"); - printf("str1: %s\n", str1); - printf("str2: %s\n", str2); - printf("str3: %s\n", str3); - printf("str4: %s\n", str4); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc070.md b/docs/semester_1/letusc/luc070.md @@ -1,88 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc070.c' -description: 'Write a program that receives a 10-digit ISBN number, computes the checksum (d1 + 2d2 + 3d3 + ... + 10d10), and reports whether the ISBN number is correct (sum divisible by 11).' -source: 'semester_1/letusc/luc070.c' ---- - -# luc070.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that receives a 10-digit ISBN number, computes the checksum (d1 + 2d2 + 3d3 + ... + 10d10), and reports whether the ISBN number is correct (sum divisible by 11). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc070.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc070.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc070.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -int main() -{ - char isbn[15]; - int i, sum = 0, digit; - - printf("Enter 10-digit ISBN number: "); - scanf("%s", isbn); - - /* The formula given is: d1 + 2d2 + 3d3 + ... + 10d10 - where di is the ith digit from the RIGHT. - - If input is "007462542X" (Length 10): - isbn[0] is d10 (Weight 10) - isbn[1] is d9 (Weight 9) - ... - isbn[9] is d1 (Weight 1) - */ - - for (i = 0; i < 10; i++) - { - // Handle 'X' which represents 10 in ISBN - if (isbn[i] == 'X' || isbn[i] == 'x') - digit = 10; - else - digit = isbn[i] - '0'; - - // Weight is (10 - i) - sum += digit * (10 - i); - } - - printf("Calculated Checksum: %d\n", sum); - - if (sum % 11 == 0) - printf("The ISBN number is Correct.\n"); - else - printf("The ISBN number is Incorrect.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc071.md b/docs/semester_1/letusc/luc071.md @@ -1,92 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc071.c' -description: 'Write a program that receives a 16-digit Credit Card number and checks whether it is valid using the Luhn algorithm variant described.' -source: 'semester_1/letusc/luc071.c' ---- - -# luc071.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that receives a 16-digit Credit Card number and checks whether it is valid using the Luhn algorithm variant described. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc071.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc071.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc071.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -int main() -{ - char card[20]; - int i, digit, sum = 0; - - printf("Enter 16-digit Credit Card number: "); - scanf("%s", card); - - /* Rule: - 1. Start with rightmost-1 digit (index 14) and multiply every other digit by 2. - (These are indices 0, 2, 4, ..., 14) - 2. Subtract 9 if result >= 10. - 3. Add these results. - 4. Add remaining digits (indices 1, 3, ..., 15). - 5. If total sum is divisible by 10, it is valid. - */ - - for (i = 0; i < 16; i++) - { - digit = card[i] - '0'; - - if (i % 2 == 0) // Indices 0, 2, 4... (Every other starting from left, which hits rightmost-1) - { - digit = digit * 2; - if (digit >= 10) - { - digit = digit - 9; - } - } - - // Add to total sum (both modified and unmodified digits) - sum += digit; - } - - printf("Total Sum: %d\n", sum); - - if (sum % 10 == 0) - printf("The Credit Card number is Valid.\n"); - else - printf("The Credit Card number is Invalid.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc072.md b/docs/semester_1/letusc/luc072.md @@ -1,95 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc072.c' -description: 'How many bytes in memory would be occupied by the following array of pointers to strings? How many bytes would be required to store the same strings in a two-dimensional character array?' -source: 'semester_1/letusc/luc072.c' ---- - -# luc072.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -How many bytes in memory would be occupied by the following array of pointers to strings? How many bytes would be required to store the same strings in a two-dimensional character array? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc072.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc072.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc072.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -int main() -{ - /* Question Analysis: - char *mess[] = {"Hammer and tongs", "Tooth and nail", "Spit and polish", "You and C"}; - - 1. Array of Pointers (*mess[]): - - It stores 4 pointers. - - Size of a pointer is typically 4 bytes (32-bit) or 8 bytes (64-bit). - - Total = 4 * sizeof(char*) - - Plus the strings themselves are stored elsewhere in memory. - - 2. Two-Dimensional Array (mess[][]): - - Must accommodate the longest string ("Hammer and tongs" = 16 chars + null = 17). - - Width would be 17 (or more). - - Size = 4 rows * 17 cols * 1 byte. - */ - - char *mess_ptr[] = { - "Hammer and tongs", - "Tooth and nail", - "Spit and polish", - "You and C" - }; - - // Longest string length + 1 for null terminator - // "Hammer and tongs" is 16 chars long. - char mess_2d[4][17] = { - "Hammer and tongs", - "Tooth and nail", - "Spit and polish", - "You and C" - }; - - printf("--- Memory Occupation Analysis ---\n\n"); - - printf("1. Array of Pointers (char *mess[]):\n"); - printf(" Size of array object itself (4 pointers): %zu bytes\n", sizeof(mess_ptr)); - printf(" (Note: The string literals are stored in read-only memory separately)\n\n"); - - printf("2. Two-Dimensional Array (char mess[4][17]):\n"); - printf(" Size of 2D array: %zu bytes\n", sizeof(mess_2d)); - printf(" (Calculation: 4 rows * 17 columns * 1 byte)\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc073.md b/docs/semester_1/letusc/luc073.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc073.c' -description: 'Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long.' -source: 'semester_1/letusc/luc073.c' ---- - -# luc073.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc073.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc073.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc073.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -int main() -{ - char str[81], res[81]; - int i, j = 0; - - printf("Enter a sentence (max 80 chars): "); - gets(str); // Note: gets is deprecated, but used here for simplicity as per classic C texts - - for (i = 0; str[i] != '\0'; i++) - { - char ch = tolower(str[i]); - if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') - { - // Skip vowel - continue; - } - else - { - res[j] = str[i]; - j++; - } - } - res[j] = '\0'; - - printf("Sentence without vowels: %s\n", res); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc074.md b/docs/semester_1/letusc/luc074.md @@ -1,89 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc074.c' -description: 'Write a program that will read a line and delete from it all occurrences of the word ''the''.' -source: 'semester_1/letusc/luc074.c' ---- - -# luc074.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that will read a line and delete from it all occurrences of the word 'the'. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc074.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc074.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc074.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -int main() -{ - char str[100], res[100]; - int i = 0, j = 0; - - printf("Enter a line of text: "); - gets(str); - - while (str[i] != '\0') - { - /* Check if the current segment matches "the" */ - /* To be a word 'the', it should effectively be surrounded by non-alphabets or start/end of string. - For simplicity in this context, we check if str[i..] starts with "the" */ - - if ((str[i] == 't' || str[i] == 'T') && - (str[i+1] == 'h' || str[i+1] == 'H') && - (str[i+2] == 'e' || str[i+2] == 'E') && - (str[i+3] == ' ' || str[i+3] == '\0')) - { - // Found "the" followed by space or null. Skip "the". - i += 3; - - // If it was followed by a space, we might want to skip the space too - // to avoid double spaces, but the problem says delete 'the'. - // Let's just skip the word. - } - else - { - res[j] = str[i]; - j++; - i++; - } - } - res[j] = '\0'; - - printf("Text after removing 'the': %s\n", res); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc075.md b/docs/semester_1/letusc/luc075.md @@ -1,106 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc075.c' -description: 'Write a program that stores a set of names of individuals and abbreviates the first and middle name to their first letter.' -source: 'semester_1/letusc/luc075.c' ---- - -# luc075.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that stores a set of names of individuals and abbreviates the first and middle name to their first letter. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc075.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc075.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc075.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -int main() -{ - char names[5][50]; - char abbr[50]; - int i, j, k, len, space_count; - - printf("Enter 5 full names (First Middle Last):\n"); - for (i = 0; i < 5; i++) - { - printf("Name %d: ", i + 1); - gets(names[i]); - } - - printf("\nAbbreviated Names:\n"); - for (i = 0; i < 5; i++) - { - len = strlen(names[i]); - space_count = 0; - k = 0; - - // Add first initial - abbr[k++] = names[i][0]; - abbr[k++] = '.'; - abbr[k++] = ' '; - - // Find spaces to get subsequent parts - for (j = 0; j < len; j++) - { - if (names[i][j] == ' ') - { - space_count++; - if (space_count == 1) // Found start of Middle name - { - abbr[k++] = names[i][j+1]; - abbr[k++] = '.'; - abbr[k++] = ' '; - } - else if (space_count == 2) // Found start of Last name - { - // Copy the rest of the last name - int m = j + 1; - while (names[i][m] != '\0') - { - abbr[k++] = names[i][m++]; - } - // Stop searching - break; - } - } - } - abbr[k] = '\0'; - printf("%s\n", abbr); - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc076.md b/docs/semester_1/letusc/luc076.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc076.c' -description: 'Write a program to count the number of occurrences of any two vowels in succession in a line of text.' -source: 'semester_1/letusc/luc076.c' ---- - -# luc076.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to count the number of occurrences of any two vowels in succession in a line of text. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc076.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc076.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc076.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -int is_vowel(char c) -{ - c = tolower(c); - return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); -} - -int main() -{ - char str[100]; - int i, count = 0; - - printf("Enter a line of text: "); - gets(str); - - printf("Occurrences found:\n"); - for (i = 0; str[i] != '\0'; i++) - { - if (is_vowel(str[i]) && is_vowel(str[i+1])) - { - printf("'%c%c' ", str[i], str[i+1]); - count++; - } - } - - printf("\n\nTotal number of successive vowels: %d\n", count); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc077.md b/docs/semester_1/letusc/luc077.md @@ -1,104 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc077.c' -description: 'Write a program that receives an integer (less than or equal to nine digits in length) and prints out the number in words.' -source: 'semester_1/letusc/luc077.c' ---- - -# luc077.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that receives an integer (less than or equal to nine digits in length) and prints out the number in words. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc077.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc077.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc077.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> - -void convert(long, char *); - -char *one[] = { - "", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ", - "Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", - "Seventeen ", "Eighteen ", "Nineteen " -}; - -char *ten[] = { - "", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " -}; - -int main() -{ - long num; - - printf("Enter a number (max 9 digits): "); - scanf("%ld", &num); - - if (num <= 0) - { - printf("Zero\n"); - } - else - { - printf("In words: "); - // Indian System: Crore, Lakh, Thousand, Hundred - convert((num / 10000000), "Crore "); - convert(((num / 100000) % 100), "Lakh "); - convert(((num / 1000) % 100), "Thousand "); - convert(((num / 100) % 10), "Hundred "); - convert((num % 100), ""); - printf("\n"); - } - - return 0; -} - -void convert(long n, char *suffix) -{ - if (n > 19) - { - printf("%s%s", ten[n / 10], one[n % 10]); - } - else - { - printf("%s", one[n]); - } - - if (n > 0) - { - printf("%s", suffix); - } -} -``` diff --git a/docs/semester_1/letusc/luc078.md b/docs/semester_1/letusc/luc078.md @@ -1,114 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc078.c' -description: 'Create a structure ''student'' (Roll, Name, Dept, Course, Year). Write functions to print names by join year and print data by roll number.' -source: 'semester_1/letusc/luc078.c' ---- - -# luc078.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create a structure 'student' (Roll, Name, Dept, Course, Year). Write functions to print names by join year and print data by roll number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc078.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc078.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc078.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct student -{ - int roll; - char name[50]; - char dept[20]; - char course[20]; - int year; -}; - -void print_by_year(struct student *s, int n, int year); -void print_by_roll(struct student *s, int n, int roll); - -int main() -{ - struct student data[450] = { - {101, "Amit", "CS", "B.Sc", 2024}, - {102, "Rahul", "Physics", "B.Sc", 2024}, - {103, "Sneha", "CS", "M.Sc", 2023}, - {104, "Priya", "Maths", "B.Sc", 2025}, - {105, "Rohan", "CS", "B.Sc", 2024} - }; - int n = 5; // Using 5 sample records - int year, roll; - - printf("Enter year to list students: "); - scanf("%d", &year); - print_by_year(data, n, year); - - printf("\nEnter roll number to find student: "); - scanf("%d", &roll); - print_by_roll(data, n, roll); - - return 0; -} - -void print_by_year(struct student *s, int n, int year) -{ - int i, found = 0; - printf("Students joining in %d:\n", year); - for (i = 0; i < n; i++) - { - if (s[i].year == year) - { - printf("- %s\n", s[i].name); - found = 1; - } - } - if (!found) printf("No students found for this year.\n"); -} - -void print_by_roll(struct student *s, int n, int roll) -{ - int i; - for (i = 0; i < n; i++) - { - if (s[i].roll == roll) - { - printf("\n--- Student Details ---\n"); - printf("Roll: %d\nName: %s\nDept: %s\nCourse: %s\nYear: %d\n", - s[i].roll, s[i].name, s[i].dept, s[i].course, s[i].year); - return; - } - } - printf("Student with Roll %d not found.\n", roll); -} -``` diff --git a/docs/semester_1/letusc/luc079.md b/docs/semester_1/letusc/luc079.md @@ -1,132 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc079.c' -description: 'Create a structure for bank customers (Acc no, Name, Balance). Write functions to print low balance customers and handle deposits/withdrawals.' -source: 'semester_1/letusc/luc079.c' ---- - -# luc079.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create a structure for bank customers (Acc no, Name, Balance). Write functions to print low balance customers and handle deposits/withdrawals. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc079.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc079.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc079.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct customer -{ - int acc_no; - char name[50]; - float balance; -}; - -void print_low_balance(struct customer *c, int n); -void transaction(struct customer *c, int n, int acc, float amount, int code); - -int main() -{ - struct customer bank[200] = { - {1001, "Alice", 5000.0}, - {1002, "Bob", 500.0}, - {1003, "Charlie", 1200.0}, - {1004, "David", 800.0}, - {1005, "Eve", 2000.0} - }; - int n = 5; - int acc, code; - float amt; - - // Task 1: Low Balance - printf("--- Customers with Balance < Rs. 1000 ---\n"); - print_low_balance(bank, n); - - // Task 2: Transaction - printf("\n--- Transaction Menu ---\n"); - printf("Enter Account No, Amount, Code (1=Deposit, 0=Withdraw): "); - scanf("%d %f %d", &acc, &amt, &code); - - transaction(bank, n, acc, amt, code); - - return 0; -} - -void print_low_balance(struct customer *c, int n) -{ - int i; - for (i = 0; i < n; i++) - { - if (c[i].balance < 1000) - { - printf("Acc: %d, Name: %s, Bal: %.2f\n", c[i].acc_no, c[i].name, c[i].balance); - } - } -} - -void transaction(struct customer *c, int n, int acc, float amount, int code) -{ - int i, found = 0; - for (i = 0; i < n; i++) - { - if (c[i].acc_no == acc) - { - found = 1; - if (code == 1) // Deposit - { - c[i].balance += amount; - printf("Deposit successful. New Balance: %.2f\n", c[i].balance); - } - else if (code == 0) // Withdraw - { - if (c[i].balance - amount < 1000) - { - printf("The balance is insufficient for the specified withdrawal (Must maintain min 1000).\n"); - } - else - { - c[i].balance -= amount; - printf("Withdrawal successful. New Balance: %.2f\n", c[i].balance); - } - } - else - { - printf("Invalid transaction code.\n"); - } - break; - } - } - if (!found) printf("Account number not found.\n"); -} -``` diff --git a/docs/semester_1/letusc/luc080.md b/docs/semester_1/letusc/luc080.md @@ -1,93 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc080.c' -description: 'Automobile engine parts (Serial AA0-FF9, Year, Material, Qty). Retrieve parts between serial numbers BB1 and CC6.' -source: 'semester_1/letusc/luc080.c' ---- - -# luc080.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Automobile engine parts (Serial AA0-FF9, Year, Material, Qty). Retrieve parts between serial numbers BB1 and CC6. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc080.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc080.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc080.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct part -{ - char serial[4]; // 3 chars + null terminator - int mfg_year; - char material[20]; - int quantity; -}; - -void retrieve_parts(struct part *p, int n); - -int main() -{ - struct part inventory[] = { - {"AA0", 2020, "Steel", 50}, - {"BB2", 2021, "Aluminum", 20}, - {"BB5", 2022, "Carbon", 10}, - {"CC1", 2021, "Steel", 100}, - {"CC7", 2023, "Titanium", 5}, - {"FF9", 2024, "Iron", 60} - }; - int n = 6; - - printf("--- Parts with Serial Numbers between BB1 and CC6 ---\n"); - retrieve_parts(inventory, n); - - return 0; -} - -void retrieve_parts(struct part *p, int n) -{ - int i; - // We compare strings lexicographically - char start[] = "BB1"; - char end[] = "CC6"; - - for (i = 0; i < n; i++) - { - if (strcmp(p[i].serial, start) >= 0 && strcmp(p[i].serial, end) <= 0) - { - printf("Serial: %s | Year: %d | Mat: %s | Qty: %d\n", - p[i].serial, p[i].mfg_year, p[i].material, p[i].quantity); - } - } -} -``` diff --git a/docs/semester_1/letusc/luc081.md b/docs/semester_1/letusc/luc081.md @@ -1,92 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc081.c' -description: 'Create structure for Cricketers (Name, Age, Tests, Avg Runs). Sort 20 records by average runs using qsort().' -source: 'semester_1/letusc/luc081.c' ---- - -# luc081.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Create structure for Cricketers (Name, Age, Tests, Avg Runs). Sort 20 records by average runs using qsort(). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc081.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc081.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc081.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct cricketer -{ - char name[30]; - int age; - int tests; - float avg_runs; -}; - -// Comparator function for qsort -int compare(const void *a, const void *b) -{ - struct cricketer *c1 = (struct cricketer *)a; - struct cricketer *c2 = (struct cricketer *)b; - - if (c1->avg_runs > c2->avg_runs) return 1; - else if (c1->avg_runs < c2->avg_runs) return -1; - else return 0; -} - -int main() -{ - // Initializing fewer than 20 for demonstration, but logic applies to 20 - struct cricketer team[5] = { - {"Kohli", 34, 110, 53.4}, - {"Smith", 33, 95, 59.8}, - {"Root", 32, 120, 50.1}, - {"Sharma", 35, 80, 45.5}, - {"Williamson", 32, 90, 54.0} - }; - int n = 5, i; - - printf("Before Sorting:\n"); - for (i = 0; i < n; i++) - printf("%s: %.2f\n", team[i].name, team[i].avg_runs); - - qsort(team, n, sizeof(struct cricketer), compare); - - printf("\nAfter Sorting (Ascending Avg Runs):\n"); - for (i = 0; i < n; i++) - printf("%s: %.2f\n", team[i].name, team[i].avg_runs); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc082.md b/docs/semester_1/letusc/luc082.md @@ -1,98 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc082.c' -description: 'Structure ''employee'' (Code, Name, Date of Joining). Display names of employees with tenure >= 3 years.' -source: 'semester_1/letusc/luc082.c' ---- - -# luc082.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Structure 'employee' (Code, Name, Date of Joining). Display names of employees with tenure >= 3 years. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc082.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc082.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc082.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct date -{ - int day; - int month; - int year; -}; - -struct employee -{ - int code; - char name[30]; - struct date doj; -}; - -int main() -{ - struct employee emp[5] = { - {101, "Amit", {12, 1, 2020}}, - {102, "Sumit", {15, 8, 2023}}, - {103, "Rina", {1, 1, 2018}}, - {104, "Tina", {20, 5, 2022}}, - {105, "Mina", {10, 12, 2025}} - }; - int n = 5, i; - struct date current; - - printf("Enter current date (dd mm yyyy): "); - scanf("%d %d %d", ¤t.day, ¤t.month, ¤t.year); - - printf("\nEmployees with tenure >= 3 years:\n"); - for (i = 0; i < n; i++) - { - int years = current.year - emp[i].doj.year; - - // Adjust for month/day - if (current.month < emp[i].doj.month || - (current.month == emp[i].doj.month && current.day < emp[i].doj.day)) - { - years--; - } - - if (years >= 3) - { - printf("%s (Tenure: %d years)\n", emp[i].name, years); - } - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc083.md b/docs/semester_1/letusc/luc083.md @@ -1,167 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc083.c' -description: 'Library menu-driven program (Add, Display, List by Author, List by Title, Count, List sorted).' -source: 'semester_1/letusc/luc083.c' ---- - -# luc083.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Library menu-driven program (Add, Display, List by Author, List by Title, Count, List sorted). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc083.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc083.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc083.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct library -{ - int acc_no; - char title[50]; - char author[50]; - float price; - int is_issued; // 1 = Yes, 0 = No -}; - -void add_book(struct library *lib, int *count); -void display_books(struct library *lib, int count); -void list_by_author(struct library *lib, int count); -void list_title_by_acc(struct library *lib, int count); -void sort_by_acc(struct library *lib, int count); - -int main() -{ - struct library books[100]; - int count = 0; - int choice; - - while (1) - { - printf("\n--- Library Menu ---\n"); - printf("1. Add Book Info\n"); - printf("2. Display Book Info\n"); - printf("3. List books of given author\n"); - printf("4. List title of specified accession number\n"); - printf("5. List count of books\n"); - printf("6. List books in order of accession number\n"); - printf("7. Exit\n"); - printf("Enter choice: "); - scanf("%d", &choice); - - switch (choice) - { - case 1: add_book(books, &count); break; - case 2: display_books(books, count); break; - case 3: list_by_author(books, count); break; - case 4: list_title_by_acc(books, count); break; - case 5: printf("Total books in library: %d\n", count); break; - case 6: sort_by_acc(books, count); display_books(books, count); break; - case 7: exit(0); - default: printf("Invalid choice!\n"); - } - } - return 0; -} - -void add_book(struct library *lib, int *count) -{ - printf("Enter Accession No, Title, Author, Price, Issued(1/0):\n"); - scanf("%d", &lib[*count].acc_no); - scanf("%s", lib[*count].title); // Using %s for simplicity (no spaces) - scanf("%s", lib[*count].author); - scanf("%f", &lib[*count].price); - scanf("%d", &lib[*count].is_issued); - (*count)++; -} - -void display_books(struct library *lib, int count) -{ - int i; - for (i = 0; i < count; i++) - printf("%d: %s by %s ($%.2f) Issued: %d\n", - lib[i].acc_no, lib[i].title, lib[i].author, lib[i].price, lib[i].is_issued); -} - -void list_by_author(struct library *lib, int count) -{ - char author[50]; - int i, found = 0; - printf("Enter author name: "); - scanf("%s", author); - for (i = 0; i < count; i++) - { - if (strcmp(lib[i].author, author) == 0) - { - printf("%s\n", lib[i].title); - found = 1; - } - } - if (!found) printf("No books found.\n"); -} - -void list_title_by_acc(struct library *lib, int count) -{ - int acc, i; - printf("Enter Accession No: "); - scanf("%d", &acc); - for (i = 0; i < count; i++) - { - if (lib[i].acc_no == acc) - { - printf("Title: %s\n", lib[i].title); - return; - } - } - printf("Book not found.\n"); -} - -void sort_by_acc(struct library *lib, int count) -{ - struct library temp; - int i, j; - for (i = 0; i < count - 1; i++) - { - for (j = 0; j < count - i - 1; j++) - { - if (lib[j].acc_no > lib[j + 1].acc_no) - { - temp = lib[j]; - lib[j] = lib[j + 1]; - lib[j + 1] = temp; - } - } - } -} -``` diff --git a/docs/semester_1/letusc/luc084.md b/docs/semester_1/letusc/luc084.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc084.c' -description: 'Define a function that compares two given dates. Return 0 if equal, otherwise return 1.' -source: 'semester_1/letusc/luc084.c' ---- - -# luc084.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Define a function that compares two given dates. Return 0 if equal, otherwise return 1. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc084.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc084.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc084.c] -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -struct date -{ - int day; - int month; - int year; -}; - -int compare_dates(struct date d1, struct date d2); - -int main() -{ - struct date date1, date2; - - printf("Enter Date 1 (dd mm yyyy): "); - scanf("%d %d %d", &date1.day, &date1.month, &date1.year); - - printf("Enter Date 2 (dd mm yyyy): "); - scanf("%d %d %d", &date2.day, &date2.month, &date2.year); - - if (compare_dates(date1, date2) == 0) - printf("The dates are Equal.\n"); - else - printf("The dates are NOT Equal.\n"); - - return 0; -} - -int compare_dates(struct date d1, struct date d2) -{ - if (d1.day == d2.day && d1.month == d2.month && d1.year == d2.year) - return 0; - else - return 1; -} -``` diff --git a/docs/semester_1/letusc/luc085.md b/docs/semester_1/letusc/luc085.md @@ -1,111 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc085.c' -description: 'Suppose a file contains student records (Name, Age). Write a program to read these records and display them in sorted order by name.' -source: 'semester_1/letusc/luc085.c' ---- - -# luc085.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Suppose a file contains student records (Name, Age). Write a program to read these records and display them in sorted order by name. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc085.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc085.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc085.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -struct student -{ - char name[40]; - int age; -}; - -void create_dummy_data(); -int compare_names(const void *a, const void *b); - -int main() -{ - FILE *fp; - struct student s[100]; - int count = 0, i; - - // Create sample file for demonstration - create_dummy_data(); - - fp = fopen("students.dat", "rb"); - if (fp == NULL) - { - printf("Cannot open file!\n"); - exit(1); - } - - // Read records into array - while (fread(&s[count], sizeof(struct student), 1, fp) == 1) - { - count++; - } - fclose(fp); - - // Sort the array - qsort(s, count, sizeof(struct student), compare_names); - - printf("--- Student List (Sorted by Name) ---\n"); - for (i = 0; i < count; i++) - { - printf("Name: %-20s Age: %d\n", s[i].name, s[i].age); - } - - return 0; -} - -int compare_names(const void *a, const void *b) -{ - return strcmp(((struct student *)a)->name, ((struct student *)b)->name); -} - -void create_dummy_data() -{ - FILE *fp = fopen("students.dat", "wb"); - struct student data[] = { - {"Zack", 20}, {"Alice", 19}, {"Bob", 21}, {"Charlie", 20}, {"Yasmine", 19} - }; - if (fp) - { - fwrite(data, sizeof(struct student), 5, fp); - fclose(fp); - } -} -``` diff --git a/docs/semester_1/letusc/luc086.md b/docs/semester_1/letusc/luc086.md @@ -1,98 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc086.c' -description: 'Write a program to copy contents of one file to another. While doing so replace all lowercase characters to their equivalent uppercase characters.' -source: 'semester_1/letusc/luc086.c' ---- - -# luc086.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to copy contents of one file to another. While doing so replace all lowercase characters to their equivalent uppercase characters. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc086.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc086.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc086.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -void create_source_file(); - -int main() -{ - FILE *fs, *ft; - char ch; - - create_source_file(); // Helper to make code runnable - - fs = fopen("source.txt", "r"); - if (fs == NULL) - { - printf("Cannot open source file.\n"); - exit(1); - } - - ft = fopen("target.txt", "w"); - if (ft == NULL) - { - printf("Cannot open target file.\n"); - fclose(fs); - exit(2); - } - - while ((ch = fgetc(fs)) != EOF) - { - ch = toupper(ch); - fputc(ch, ft); - } - - printf("File copied successfully with uppercase conversion.\n"); - printf("Check 'target.txt' for results.\n"); - - fclose(fs); - fclose(ft); - - return 0; -} - -void create_source_file() -{ - FILE *fp = fopen("source.txt", "w"); - if (fp) - { - fprintf(fp, "This is a sample text.\nIt contains Lowercase letters.\n"); - fclose(fp); - } -} -``` diff --git a/docs/semester_1/letusc/luc087.md b/docs/semester_1/letusc/luc087.md @@ -1,117 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc087.c' -description: 'Write a program that merges lines alternately from two files and writes the results to a new file. Handle remaining lines if file sizes differ.' -source: 'semester_1/letusc/luc087.c' ---- - -# luc087.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that merges lines alternately from two files and writes the results to a new file. Handle remaining lines if file sizes differ. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc087.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc087.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc087.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -void create_sample_files(); - -int main() -{ - FILE *fp1, *fp2, *fp3; - char line1[100], line2[100]; - char *res1, *res2; - - create_sample_files(); - - fp1 = fopen("file1.txt", "r"); - fp2 = fopen("file2.txt", "r"); - fp3 = fopen("merge.txt", "w"); - - if (fp1 == NULL || fp2 == NULL || fp3 == NULL) - { - printf("File error.\n"); - exit(1); - } - - // Read lines from both files - res1 = fgets(line1, sizeof(line1), fp1); - res2 = fgets(line2, sizeof(line2), fp2); - - while (res1 != NULL && res2 != NULL) - { - fputs(line1, fp3); - fputs(line2, fp3); - - res1 = fgets(line1, sizeof(line1), fp1); - res2 = fgets(line2, sizeof(line2), fp2); - } - - // Append remaining lines from file 1 - while (res1 != NULL) - { - fputs(line1, fp3); - res1 = fgets(line1, sizeof(line1), fp1); - } - - // Append remaining lines from file 2 - while (res2 != NULL) - { - fputs(line2, fp3); - res2 = fgets(line2, sizeof(line2), fp2); - } - - printf("Files merged alternately into 'merge.txt'.\n"); - - fclose(fp1); - fclose(fp2); - fclose(fp3); - - return 0; -} - -void create_sample_files() -{ - FILE *f1 = fopen("file1.txt", "w"); - FILE *f2 = fopen("file2.txt", "w"); - - fprintf(f1, "File 1 - Line A\nFile 1 - Line B\nFile 1 - Line C\n"); - fprintf(f2, "File 2 - Line 1\nFile 2 - Line 2\nFile 2 - Line 3\nFile 2 - Line 4\n"); - - fclose(f1); - fclose(f2); -} -``` diff --git a/docs/semester_1/letusc/luc088.md b/docs/semester_1/letusc/luc088.md @@ -1,104 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc088.c' -description: 'Write a program to encrypt/decrypt a file using: (1) Offset cipher (2) Substitution cipher.' -source: 'semester_1/letusc/luc088.c' ---- - -# luc088.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to encrypt/decrypt a file using: (1) Offset cipher (2) Substitution cipher. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc088.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc088.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc088.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -void create_plain_file(); - -int main() -{ - FILE *fs, *ft; - char ch; - int choice; - - create_plain_file(); - - printf("1. Offset Cipher\n2. Substitution Cipher\nEnter choice: "); - scanf("%d", &choice); - - fs = fopen("plain.txt", "r"); - ft = fopen("coded.txt", "w"); - - if (fs == NULL || ft == NULL) - { - printf("Error opening files.\n"); - exit(1); - } - - while ((ch = fgetc(fs)) != EOF) - { - if (choice == 1) - { - // Offset Cipher: Add 128 (effectively shifts char code) - fputc(ch + 10, ft); // Using +10 for visibility, problem says 128 - } - else - { - // Simple Substitution: A->!, B->@ etc. - // Here, we'll just map any char to char+5 for simplicity - // as true substitution requires a full map array. - fputc(ch + 5, ft); - } - } - - printf("Encryption complete. Check 'coded.txt'.\n"); - - fclose(fs); - fclose(ft); - return 0; -} - -void create_plain_file() -{ - FILE *fp = fopen("plain.txt", "w"); - if (fp) - { - fprintf(fp, "SECRET MESSAGE"); - fclose(fp); - } -} -``` diff --git a/docs/semester_1/letusc/luc089.md b/docs/semester_1/letusc/luc089.md @@ -1,147 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc089.c' -description: 'Update ''CUSTOMER.DAT'' balance using ''TRANSACTIONS.DAT'' (Deposit/Withdrawal). Ensure balance doesn''t fall below Rs. 100 on withdrawal.' -source: 'semester_1/letusc/luc089.c' ---- - -# luc089.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Update 'CUSTOMER.DAT' balance using 'TRANSACTIONS.DAT' (Deposit/Withdrawal). Ensure balance doesn't fall below Rs. 100 on withdrawal. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc089.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc089.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc089.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -struct customer { - int accno; - char name[30]; - float balance; -}; - -struct trans { - int accno; - char trans_type; - float amount; -}; - -void create_files(); -void update_customer(struct customer *c, int n, struct trans t); - -int main() -{ - FILE *fc, *ft; - struct customer cust[100]; - struct trans t; - int i, n_cust = 0; - - create_files(); // Generate dummy data - - // 1. Load all customers into memory - fc = fopen("CUSTOMER.DAT", "rb"); - if (fc == NULL) exit(1); - - while (fread(&cust[n_cust], sizeof(struct customer), 1, fc) == 1) - { - n_cust++; - } - fclose(fc); - - // 2. Process transactions sequentially - ft = fopen("TRANSACTIONS.DAT", "rb"); - if (ft == NULL) exit(2); - - printf("Processing Transactions...\n"); - while (fread(&t, sizeof(struct trans), 1, ft) == 1) - { - update_customer(cust, n_cust, t); - } - fclose(ft); - - // 3. Write updated data back to CUSTOMER.DAT - fc = fopen("CUSTOMER.DAT", "wb"); - fwrite(cust, sizeof(struct customer), n_cust, fc); - fclose(fc); - - printf("Update Complete. New Balances:\n"); - for(i=0; i<n_cust; i++) - printf("%d %s: %.2f\n", cust[i].accno, cust[i].name, cust[i].balance); - - return 0; -} - -void update_customer(struct customer *c, int n, struct trans t) -{ - int i; - for (i = 0; i < n; i++) - { - if (c[i].accno == t.accno) - { - if (t.trans_type == 'D') - { - c[i].balance += t.amount; - printf("Acc %d: Deposited %.2f\n", t.accno, t.amount); - } - else if (t.trans_type == 'W') - { - if ((c[i].balance - t.amount) >= 100) - { - c[i].balance -= t.amount; - printf("Acc %d: Withdrew %.2f\n", t.accno, t.amount); - } - else - { - printf("Acc %d: Withdrawal denied (Min bal constraint)\n", t.accno); - } - } - return; - } - } - printf("Transaction Error: Acc %d not found\n", t.accno); -} - -void create_files() -{ - struct customer c[] = {{101, "A", 500}, {102, "B", 1000}, {103, "C", 200}}; - struct trans t[] = {{101, 'D', 200}, {102, 'W', 500}, {103, 'W', 150}}; // 103 fail - FILE *f1 = fopen("CUSTOMER.DAT", "wb"); - FILE *f2 = fopen("TRANSACTIONS.DAT", "wb"); - fwrite(c, sizeof(struct customer), 3, f1); - fwrite(t, sizeof(struct trans), 3, f2); - fclose(f1); fclose(f2); -} -``` diff --git a/docs/semester_1/letusc/luc090.md b/docs/semester_1/letusc/luc090.md @@ -1,118 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc090.c' -description: 'Read employee records (code, name, date, salary), sort them by Date of Joining, and write to a target file.' -source: 'semester_1/letusc/luc090.c' ---- - -# luc090.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Read employee records (code, name, date, salary), sort them by Date of Joining, and write to a target file. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc090.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc090.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc090.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -struct date { int d, m, y; }; -struct employee { - int empcode[6]; // Not used as int array usually, likely int id. Assuming int code. - char empname[20]; - struct date join_date; - float salary; -}; - -// Redefining struct for easier usage assuming empcode is int -struct emp_clean { - int code; - char name[20]; - struct date doj; - float salary; -}; - -void create_emp_file(); -int compare_dates(const void *a, const void *b); - -int main() -{ - FILE *fp, *ft; - struct emp_clean e[50]; - int count = 0, i; - - create_emp_file(); - - fp = fopen("employee.dat", "rb"); - if (!fp) return 1; - - while (fread(&e[count], sizeof(struct emp_clean), 1, fp) == 1) - count++; - fclose(fp); - - qsort(e, count, sizeof(struct emp_clean), compare_dates); - - ft = fopen("emp_sorted.dat", "wb"); - fwrite(e, sizeof(struct emp_clean), count, ft); - fclose(ft); - - printf("Sorted records written to 'emp_sorted.dat'.\nDisplaying sorted list:\n"); - for(i=0; i<count; i++) - printf("%s - %02d/%02d/%04d\n", e[i].name, e[i].doj.d, e[i].doj.m, e[i].doj.y); - - return 0; -} - -int compare_dates(const void *a, const void *b) -{ - struct emp_clean *e1 = (struct emp_clean *)a; - struct emp_clean *e2 = (struct emp_clean *)b; - - if (e1->doj.y != e2->doj.y) return e1->doj.y - e2->doj.y; - if (e1->doj.m != e2->doj.m) return e1->doj.m - e2->doj.m; - return e1->doj.d - e2->doj.d; -} - -void create_emp_file() -{ - struct emp_clean data[] = { - {1, "John", {12, 5, 2022}, 5000}, - {2, "Jane", {10, 1, 2020}, 6000}, // Senior - {3, "Bob", {15, 8, 2021}, 5500} - }; - FILE *f = fopen("employee.dat", "wb"); - fwrite(data, sizeof(struct emp_clean), 3, f); - fclose(f); -} -``` diff --git a/docs/semester_1/letusc/luc091.md b/docs/semester_1/letusc/luc091.md @@ -1,98 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc091.c' -description: 'Read ''blood donors'' file (Name, Address, Age, Blood Type). Print donors with Age < 25 and Blood Type 2.' -source: 'semester_1/letusc/luc091.c' ---- - -# luc091.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Read 'blood donors' file (Name, Address, Age, Blood Type). Print donors with Age < 25 and Blood Type 2. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc091.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc091.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc091.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -struct donor { - char name[21]; // 20 cols + null - char address[41]; // 40 cols + null - int age; // 2 cols -> int - int blood_type; // 1 col -> int -}; - -void create_donor_file(); - -int main() -{ - FILE *fp; - struct donor d; - - create_donor_file(); - - fp = fopen("donors.dat", "rb"); - if (!fp) - { - printf("File error.\n"); - exit(1); - } - - printf("--- Donors (Age < 25, Type 2) ---\n"); - while (fread(&d, sizeof(struct donor), 1, fp) == 1) - { - if (d.age < 25 && d.blood_type == 2) - { - printf("Name: %s | Age: %d | Addr: %s\n", d.name, d.age, d.address); - } - } - - fclose(fp); - return 0; -} - -void create_donor_file() -{ - struct donor data[] = { - {"Amit", "Delhi", 22, 2}, // Match - {"Rahul", "Mumbai", 30, 2}, // Old - {"Sumit", "Pune", 21, 1}, // Wrong type - {"Priya", "Goa", 24, 2} // Match - }; - FILE *f = fopen("donors.dat", "wb"); - fwrite(data, sizeof(struct donor), 4, f); - fclose(f); -} -``` diff --git a/docs/semester_1/letusc/luc092.md b/docs/semester_1/letusc/luc092.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc092.c' -description: 'Write a program to store names in a file. Display the n-th name in the list, where n is read from the keyboard.' -source: 'semester_1/letusc/luc092.c' ---- - -# luc092.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to store names in a file. Display the n-th name in the list, where n is read from the keyboard. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc092.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc092.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc092.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -void create_name_file(); - -int main() -{ - FILE *fp; - char name[50]; - int n, current = 0, found = 0; - - create_name_file(); - - printf("Enter value of n to find n-th name: "); - scanf("%d", &n); - - fp = fopen("names.txt", "r"); - if (!fp) exit(1); - - // Assuming one name per line - while (fgets(name, sizeof(name), fp) != NULL) - { - current++; - if (current == n) - { - printf("The %d-th name is: %s", n, name); - found = 1; - break; - } - } - - if (!found) - printf("Record not found (Only %d names exist).\n", current); - - fclose(fp); - return 0; -} - -void create_name_file() -{ - FILE *f = fopen("names.txt", "w"); - fprintf(f, "Alice\nBob\nCharlie\nDavid\nEve\nFrank\n"); - fclose(f); -} -``` diff --git a/docs/semester_1/letusc/luc093.md b/docs/semester_1/letusc/luc093.md @@ -1,160 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc093.c' -description: 'Update Master file (Roll, Name) using Transaction file (Roll, Code Add/Delete). Both files are sorted by Roll.' -source: 'semester_1/letusc/luc093.c' ---- - -# luc093.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Update Master file (Roll, Name) using Transaction file (Roll, Code Add/Delete). Both files are sorted by Roll. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc093.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc093.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc093.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -struct student { - int roll; - char name[30]; -}; - -struct trans { - int roll; - char code; // 'A' for Add, 'D' for Delete - char name[30]; // Only needed for Add -}; - -void create_files(); - -int main() -{ - FILE *fm, *ft, *fn; - struct student m; - struct trans t; - int has_m, has_t; - - create_files(); - - fm = fopen("MASTER.DAT", "rb"); - ft = fopen("TRANS_ROLL.DAT", "rb"); - fn = fopen("NEW_MASTER.DAT", "wb"); - - if (!fm || !ft || !fn) exit(1); - - has_m = fread(&m, sizeof(struct student), 1, fm); - has_t = fread(&t, sizeof(struct trans), 1, ft); - - printf("Merging Master and Transaction files...\n"); - - while (has_m && has_t) - { - if (m.roll < t.roll) - { - // No transaction for this master record, keep it - fwrite(&m, sizeof(struct student), 1, fn); - has_m = fread(&m, sizeof(struct student), 1, fm); - } - else if (m.roll == t.roll) - { - // Transaction affects this record - if (t.code == 'D') - { - printf("Deleting Roll %d\n", m.roll); - // Skip writing 'm' to file (Deleting) - has_m = fread(&m, sizeof(struct student), 1, fm); - } - else - { - // Logic error: Can't ADD if ID exists. Maybe Update? - // Assuming replace or skip. Let's skip T and keep M for now. - has_m = fread(&m, sizeof(struct student), 1, fm); - } - has_t = fread(&t, sizeof(struct trans), 1, ft); - } - else // m.roll > t.roll - { - // Transaction ID is new - if (t.code == 'A') - { - struct student new_s; - new_s.roll = t.roll; - strcpy(new_s.name, t.name); - fwrite(&new_s, sizeof(struct student), 1, fn); - printf("Adding Roll %d\n", new_s.roll); - } - has_t = fread(&t, sizeof(struct trans), 1, ft); - } - } - - // Process remaining Master - while (has_m) - { - fwrite(&m, sizeof(struct student), 1, fn); - has_m = fread(&m, sizeof(struct student), 1, fm); - } - - // Process remaining Transactions (Only Adds) - while (has_t) - { - if (t.code == 'A') - { - struct student new_s = {t.roll, ""}; - strcpy(new_s.name, t.name); - fwrite(&new_s, sizeof(struct student), 1, fn); - printf("Adding Roll %d\n", new_s.roll); - } - has_t = fread(&t, sizeof(struct trans), 1, ft); - } - - fclose(fm); fclose(ft); fclose(fn); - return 0; -} - -void create_files() -{ - struct student m[] = {{10, "A"}, {20, "B"}, {30, "C"}}; - struct trans t[] = {{15, 'A', "NewGuy"}, {20, 'D', ""}, {40, 'A', "LastGuy"}}; - - FILE *f1 = fopen("MASTER.DAT", "wb"); - fwrite(m, sizeof(struct student), 3, f1); - fclose(f1); - - FILE *f2 = fopen("TRANS_ROLL.DAT", "wb"); - fwrite(t, sizeof(struct trans), 3, f2); - fclose(f2); -} -``` diff --git a/docs/semester_1/letusc/luc094.md b/docs/semester_1/letusc/luc094.md @@ -1,95 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc094.c' -description: 'Read a text file, delete the words ''a'', ''the'', ''an'' and replace each with a blank space. Write to new file.' -source: 'semester_1/letusc/luc094.c' ---- - -# luc094.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Read a text file, delete the words 'a', 'the', 'an' and replace each with a blank space. Write to new file. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc094.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc094.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc094.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -void create_article_file(); - -int main() -{ - FILE *fp, *ft; - char word[100]; - - create_article_file(); - - fp = fopen("articles.txt", "r"); - ft = fopen("clean.txt", "w"); - - if (!fp || !ft) exit(1); - - // Basic word-by-word processing using fscanf - // Note: fscanf skips whitespace, so original spacing formatting - // might be lost, but it effectively filters words. - - while (fscanf(fp, "%s", word) != EOF) - { - if (strcasecmp(word, "a") == 0 || - strcasecmp(word, "an") == 0 || - strcasecmp(word, "the") == 0) - { - fputc(' ', ft); // Replace with blank - } - else - { - fprintf(ft, "%s ", word); - } - } - - printf("Processed file. Articles removed in 'clean.txt'.\n"); - - fclose(fp); - fclose(ft); - return 0; -} - -void create_article_file() -{ - FILE *f = fopen("articles.txt", "w"); - fprintf(f, "The quick brown fox jumps over a lazy dog. It was an honour."); - fclose(f); -} -``` diff --git a/docs/semester_1/letusc/luc095.md b/docs/semester_1/letusc/luc095.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc095.c' -description: 'Write a program that can read a file and display its contents. The file name should be supplied as a command-line argument.' -source: 'semester_1/letusc/luc095.c' ---- - -# luc095.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that can read a file and display its contents. The file name should be supplied as a command-line argument. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc095.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc095.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc095.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -int main(int argc, char *argv[]) -{ - FILE *fp; - char ch; - - /* Check if file name is provided */ - if (argc != 2) - { - printf("Usage: %s <filename>\n", argv[0]); - exit(1); - } - - fp = fopen(argv[1], "r"); - if (fp == NULL) - { - printf("Error: Cannot open file '%s'\n", argv[1]); - exit(2); - } - - /* Read and display contents */ - while ((ch = fgetc(fp)) != EOF) - { - printf("%c", ch); - } - - fclose(fp); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc096.md b/docs/semester_1/letusc/luc096.md @@ -1,89 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc096.c' -description: 'Write a program that can copy the contents of one file to another. The source and target filenames should be supplied as command-line arguments.' -source: 'semester_1/letusc/luc096.c' ---- - -# luc096.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that can copy the contents of one file to another. The source and target filenames should be supplied as command-line arguments. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc096.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc096.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc096.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -int main(int argc, char *argv[]) -{ - FILE *fs, *ft; - char ch; - - /* Check for correct number of arguments */ - if (argc != 3) - { - printf("Usage: %s <source_file> <target_file>\n", argv[0]); - exit(1); - } - - fs = fopen(argv[1], "r"); - if (fs == NULL) - { - printf("Error: Cannot open source file '%s'\n", argv[1]); - exit(2); - } - - ft = fopen(argv[2], "w"); - if (ft == NULL) - { - printf("Error: Cannot create target file '%s'\n", argv[2]); - fclose(fs); - exit(3); - } - - /* Copy contents */ - while ((ch = fgetc(fs)) != EOF) - { - fputc(ch, ft); - } - - printf("File copied successfully.\n"); - - fclose(fs); - fclose(ft); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc097.md b/docs/semester_1/letusc/luc097.md @@ -1,131 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc097.c' -description: 'Write a program using command-line arguments to search for a word in a file and replace it with the specified word.\nUsage: change <old word> <new word> <filename>' -source: 'semester_1/letusc/luc097.c' ---- - -# luc097.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using command-line arguments to search for a word in a file and replace it with the specified word.\nUsage: change <old word> <new word> <filename> -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc097.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc097.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc097.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -void replace_all(char *str, const char *old_w, const char *new_w, FILE *ft); - -int main(int argc, char *argv[]) -{ - FILE *fp, *ft; - char line[1000]; - char *old_word, *new_word, *filename; - - if (argc != 4) - { - printf("Usage: %s <old word> <new word> <filename>\n", argv[0]); - exit(1); - } - - old_word = argv[1]; - new_word = argv[2]; - filename = argv[3]; - - fp = fopen(filename, "r"); - if (fp == NULL) - { - printf("Error opening file: %s\n", filename); - exit(2); - } - - // Create a temporary file - ft = fopen("temp.tmp", "w"); - if (ft == NULL) - { - printf("Error creating temporary file.\n"); - fclose(fp); - exit(3); - } - - // Process line by line - while (fgets(line, sizeof(line), fp)) - { - replace_all(line, old_word, new_word, ft); - } - - fclose(fp); - fclose(ft); - - // Replace original file with updated file - remove(filename); - rename("temp.tmp", filename); - - printf("Replacement complete.\n"); - - return 0; -} - -void replace_all(char *str, const char *old_w, const char *new_w, FILE *ft) -{ - char *pos, temp[1000]; - int index = 0; - int old_len = strlen(old_w); - - /* We cannot easily modify 'str' in place because new_w - might be larger than old_w. We write directly to file. - */ - - while ((pos = strstr(str, old_w)) != NULL) - { - // Write everything before the match - while (str < pos) - { - fputc(*str, ft); - str++; - } - - // Write the new word - fputs(new_w, ft); - - // Skip the old word in the source string - str += old_len; - } - - // Write the remainder of the line - fputs(str, ft); -} -``` diff --git a/docs/semester_1/letusc/luc098.md b/docs/semester_1/letusc/luc098.md @@ -1,109 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc098.c' -description: 'Write a calculator utility using command line arguments.\nUsage: calc <switch> <n> <m>\nwhere switch is arithmetic operator or comparison operator.' -source: 'semester_1/letusc/luc098.c' ---- - -# luc098.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a calculator utility using command line arguments.\nUsage: calc <switch> <n> <m>\nwhere switch is arithmetic operator or comparison operator. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc098.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc098.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc098.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -int main(int argc, char *argv[]) -{ - float n, m, res; - char operator; - - if (argc != 4) - { - printf("Usage: %s <switch> <n> <m>\n", argv[0]); - printf("Example: %s + 10 20\n", argv[0]); - printf("Note: For multiplication (*), use '*' or x to avoid shell expansion.\n"); - exit(1); - } - - operator = argv[1][0]; // First character of the switch argument - n = atof(argv[2]); - m = atof(argv[3]); - - switch (operator) - { - // Arithmetic - case '+': - printf("%.2f\n", n + m); - break; - case '-': - printf("%.2f\n", n - m); - break; - case 'x': - case '*': - printf("%.2f\n", n * m); - break; - case '/': - if (m == 0) printf("Error: Division by zero\n"); - else printf("%.2f\n", n / m); - break; - case '%': - printf("%d\n", (int)n % (int)m); - break; - - // Comparison - case '<': - printf("%s\n", (n < m) ? "True" : "False"); - break; - case '>': - printf("%s\n", (n > m) ? "True" : "False"); - break; - - // Handling symbols that might be multi-char (e.g. <=, >=, ==) is tricky - // with argv[1][0], but basic logic for typical single char switches: - case '=': - printf("%s\n", (n == m) ? "True" : "False"); - break; - - default: - printf("Unknown operator: %c\n", operator); - break; - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc099.md b/docs/semester_1/letusc/luc099.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc099.c' -description: 'Read an integer ''game'' representing sports won by a college. Determine if it won the ''Champion of Champions'' trophy (>5 games) and list games won.' -source: 'semester_1/letusc/luc099.c' ---- - -# luc099.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Read an integer 'game' representing sports won by a college. Determine if it won the 'Champion of Champions' trophy (>5 games) and list games won. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc099.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc099.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc099.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int game; - int count = 0, i; - const char *sports[] = { - "Cricket", "Basketball", "Football", "Hockey", - "Lawn Tennis", "Table Tennis", "Carom", "Chess", "Volleyball" // Added one for bit 8 - }; - - printf("Enter the game information (integer): "); - scanf("%d", &game); - - printf("\nGames won:\n"); - for (i = 0; i <= 8; i++) - { - if (game & (1 << i)) - { - printf("- %s\n", sports[i]); - count++; - } - } - - printf("\nTotal games won: %d\n", count); - - if (count >= 5) - printf("Result: The college won the Champion of Champions trophy.\n"); - else - printf("Result: The college did NOT win the trophy.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc100.md b/docs/semester_1/letusc/luc100.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc100.c' -description: 'Determine if an animal is Carnivore/Herbivore and its type (Canine, Feline, Cetacean, Marsupial) based on bits in an integer.' -source: 'semester_1/letusc/luc100.c' ---- - -# luc100.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Determine if an animal is Carnivore/Herbivore and its type (Canine, Feline, Cetacean, Marsupial) based on bits in an integer. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc100.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc100.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc100.c] -#include <stdio.h> -#include <stdlib.h> - -struct animal -{ - char name[30]; - int type; -}; - -int main() -{ - struct animal a = {"OCELOT", 18}; - int type = a.type; - - printf("Animal: %s\n", a.name); - - // Check Bit 4 for Diet (Assuming 1=Carnivore, 0=Herbivore based on context) - if (type & (1 << 4)) - printf("Diet: Carnivore\n"); - else - printf("Diet: Herbivore\n"); - - // Check Bits 0-3 for Family - printf("Family: "); - if (type & (1 << 0)) printf("Canine "); - if (type & (1 << 1)) printf("Feline "); - if (type & (1 << 2)) printf("Cetacean "); - if (type & (1 << 3)) printf("Marsupial "); - printf("\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc101.md b/docs/semester_1/letusc/luc101.md @@ -1,85 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc101.c' -description: 'Decode student information (Year, Stream, Room No) packed into an integer array.' -source: 'semester_1/letusc/luc101.c' ---- - -# luc101.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Decode student information (Year, Stream, Room No) packed into an integer array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc101.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc101.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc101.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int data[] = {273, 548, 786, 1096}; - int n = 4, i; - int val, year, stream_bits, room; - - for (i = 0; i < n; i++) - { - val = data[i]; - - // Room Number: Rest of the bits (Assuming starting from bit 8) - room = val >> 8; - - printf("Student %d (Raw: %d):\n", i + 1, val); - printf(" Room No: %d\n", room); - - // Year: Bits 0-3 - printf(" Year: "); - if (val & (1 << 0)) printf("1st Year"); - else if (val & (1 << 1)) printf("2nd Year"); - else if (val & (1 << 2)) printf("3rd Year"); - else if (val & (1 << 3)) printf("4th Year"); - else printf("Unknown"); - printf("\n"); - - // Stream: Bits 4-7 (Mech, Chem, Elec, CS) - printf(" Stream: "); - if (val & (1 << 4)) printf("Mechanical"); - else if (val & (1 << 5)) printf("Chemical"); - else if (val & (1 << 6)) printf("Electronics"); - else if (val & (1 << 7)) printf("CS"); - else printf("Unknown"); - printf("\n\n"); - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc102.md b/docs/semester_1/letusc/luc102.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc102.c' -description: 'What will be the output of the provided program segment involving bitwise operators?' -source: 'semester_1/letusc/luc102.c' ---- - -# luc102.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -What will be the output of the provided program segment involving bitwise operators? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc102.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc102.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc102.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int i = 32, j = 65, k, l, m, n, o, p; - - k = i | 35; - l = ~k; - m = i & j; - n = j ^ 32; - o = j << 2; - p = i >> 5; - - printf("k = %d l = %d m = %d\n", k, l, m); - printf("n = %d o = %d p = %d\n", n, o, p); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc103.md b/docs/semester_1/letusc/luc103.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc103.c' -description: 'What is the hexadecimal equivalent of the following binary numbers?' -source: 'semester_1/letusc/luc103.c' ---- - -# luc103.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -What is the hexadecimal equivalent of the following binary numbers? -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc103.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc103.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc103.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - // Binary numbers represented as string literals for reference - // 01011010 - // 11000011 - // 1010101001110101 - // 111100001011010 - - printf("Binary: 01011010 -> Hex: 0x%X\n", 0b01011010); - printf("Binary: 11000011 -> Hex: 0x%X\n", 0b11000011); - printf("Binary: 1010101001110101 -> Hex: 0x%X\n", 0b1010101001110101); - printf("Binary: 111100001011010 -> Hex: 0x%X\n", 0b111100001011010); - - /* Note: Binary literals (0b...) are a standard C extension (GCC) and part of C23 standard. */ - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc104.md b/docs/semester_1/letusc/luc104.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc104.c' -description: 'Rewrite expressions using bitwise compound assignment operators.' -source: 'semester_1/letusc/luc104.c' ---- - -# luc104.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Rewrite expressions using bitwise compound assignment operators. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc104.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc104.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc104.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - int a = 10, b = 20, c = 5; - - printf("Original values: a=%d, b=%d, c=%d\n", a, b, c); - - // a = a | 3 - a |= 3; - printf("a |= 3 -> %d\n", a); - - // a = a & 0x48 - a &= 0x48; - printf("a &= 0x48 -> %d\n", a); - - // b = b ^ 0x22 - b ^= 0x22; - printf("b ^= 0x22 -> %d\n", b); - - // c = c << 2 - c <<= 2; - printf("c <<= 2 -> %d\n", c); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc105.md b/docs/semester_1/letusc/luc105.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc105.c' -description: 'Write a function checkbits(x, p, n) which returns true if all ''n'' bits starting from position ''p'' are turned on.' -source: 'semester_1/letusc/luc105.c' ---- - -# luc105.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function checkbits(x, p, n) which returns true if all 'n' bits starting from position 'p' are turned on. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc105.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc105.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc105.c] -#include <stdio.h> -#include <stdlib.h> - -int checkbits(unsigned int x, int p, int n); - -int main() -{ - unsigned int x; - int p, n; - - printf("Enter number (x): "); - scanf("%u", &x); - printf("Enter starting position (p) and count (n): "); - scanf("%d %d", &p, &n); - - if (checkbits(x, p, n)) - printf("TRUE: %d bits starting at %d are ON.\n", n, p); - else - printf("FALSE: Not all specified bits are ON.\n"); - - return 0; -} - -int checkbits(unsigned int x, int p, int n) -{ - unsigned int mask; - - // Create a mask of n 1s. E.g., if n=3, mask=000...0111 - mask = (1 << n) - 1; - - // Shift mask to position p - mask = mask << p; - - // Check if bits in x match the mask - return (x & mask) == mask; -} -``` diff --git a/docs/semester_1/letusc/luc106.md b/docs/semester_1/letusc/luc106.md @@ -1,67 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc106.c' -description: 'Write a program to scan an 8-bit number and check whether its 3rd, 6th and 7th bit is on.' -source: 'semester_1/letusc/luc106.c' ---- - -# luc106.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to scan an 8-bit number and check whether its 3rd, 6th and 7th bit is on. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc106.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc106.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc106.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - unsigned char num; - - printf("Enter an 8-bit integer (0-255): "); - scanf("%hhu", &num); - - // Checking bits 3, 6, 7. - // Assuming 0-based indexing: 3rd bit is index 3 (value 8), 6th is index 6 (64), 7th is index 7 (128). - - unsigned char mask = (1 << 3) | (1 << 6) | (1 << 7); - - if ((num & mask) == mask) - printf("Bits 3, 6, and 7 are ALL ON.\n"); - else - printf("Bits 3, 6, and 7 are NOT all on.\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc107.md b/docs/semester_1/letusc/luc107.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc107.c' -description: 'Receive an unsigned 16-bit integer and exchange the contents of its 2 bytes using bitwise operators.' -source: 'semester_1/letusc/luc107.c' ---- - -# luc107.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Receive an unsigned 16-bit integer and exchange the contents of its 2 bytes using bitwise operators. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc107.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc107.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc107.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - unsigned short num, swapped; - - printf("Enter a 16-bit number (0-65535): "); - scanf("%hu", &num); - - // Exchange bytes: - // 1. (num & 0xFF00) >> 8 : Move High Byte to Low Byte position - // 2. (num & 0x00FF) << 8 : Move Low Byte to High Byte position - - swapped = ((num & 0xFF00) >> 8) | ((num & 0x00FF) << 8); - - printf("Original: %hu (Hex: 0x%04X)\n", num, num); - printf("Swapped: %hu (Hex: 0x%04X)\n", swapped, swapped); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc108.md b/docs/semester_1/letusc/luc108.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc108.c' -description: 'Receive an 8-bit number and exchange its higher 4 bits with lower 4 bits.' -source: 'semester_1/letusc/luc108.c' ---- - -# luc108.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Receive an 8-bit number and exchange its higher 4 bits with lower 4 bits. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc108.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc108.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc108.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - unsigned char num, swapped; - - printf("Enter an 8-bit number (0-255): "); - scanf("%hhu", &num); - - // Exchange nibbles - // (num & 0xF0) >> 4 : High nibble to Low - // (num & 0x0F) << 4 : Low nibble to High - - swapped = ((num & 0xF0) >> 4) | ((num & 0x0F) << 4); - - printf("Original: %d (Hex: 0x%02X)\n", num, num); - printf("Swapped: %d (Hex: 0x%02X)\n", swapped, swapped); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc109.md b/docs/semester_1/letusc/luc109.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc109.c' -description: 'Receive an 8-bit number and set its odd bits to 1.' -source: 'semester_1/letusc/luc109.c' ---- - -# luc109.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Receive an 8-bit number and set its odd bits to 1. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc109.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc109.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc109.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - unsigned char num, res; - - printf("Enter an 8-bit number: "); - scanf("%hhu", &num); - - // Odd bits usually refer to positions 1, 3, 5, 7. - // Mask: 1010 1010 (binary) = 0xAA - // OR operation sets bits to 1. - - res = num | 0xAA; - - printf("Original: 0x%02X\n", num); - printf("Result: 0x%02X\n", res); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc110.md b/docs/semester_1/letusc/luc110.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc110.c' -description: 'Receive an 8-bit number. Check if 3rd and 5th bits are ON. If yes, put them OFF.' -source: 'semester_1/letusc/luc110.c' ---- - -# luc110.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Receive an 8-bit number. Check if 3rd and 5th bits are ON. If yes, put them OFF. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc110.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc110.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc110.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - unsigned char num; - unsigned char mask = (1 << 3) | (1 << 5); // Bits 3 and 5 - - printf("Enter an 8-bit number: "); - scanf("%hhu", &num); - - if ((num & mask) == mask) - { - printf("Bits 3 and 5 are ON. Turning them OFF...\n"); - // XOR with mask toggles 1 to 0 (since they are 1) - // OR: AND with complement mask (~mask) - num = num & ~mask; - } - else - { - printf("Bits 3 and 5 are NOT both ON. No change.\n"); - } - - printf("Final Value: %d (0x%02X)\n", num, num); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc111.md b/docs/semester_1/letusc/luc111.md @@ -1,71 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc111.c' -description: 'Receive an 8-bit number. Check if 3rd and 5th bits are OFF. If yes, put them ON.' -source: 'semester_1/letusc/luc111.c' ---- - -# luc111.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Receive an 8-bit number. Check if 3rd and 5th bits are OFF. If yes, put them ON. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc111.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc111.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc111.c] -#include <stdio.h> -#include <stdlib.h> - -int main() -{ - unsigned char num; - unsigned char mask = (1 << 3) | (1 << 5); - - printf("Enter an 8-bit number: "); - scanf("%hhu", &num); - - // Check if bits are OFF. (num & mask) should be 0. - if ((num & mask) == 0) - { - printf("Bits 3 and 5 are OFF. Turning them ON...\n"); - num = num | mask; - } - else - { - printf("Bits 3 and 5 are NOT both OFF. No change.\n"); - } - - printf("Final Value: %d (0x%02X)\n", num, num); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc112.md b/docs/semester_1/letusc/luc112.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc112.c' -description: 'Rewrite the showbits() function using the _BV macro.' -source: 'semester_1/letusc/luc112.c' ---- - -# luc112.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Rewrite the showbits() function using the _BV macro. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc112.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc112.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc112.c] -#include <stdio.h> -#include <stdlib.h> - -/* _BV(x) macro usually expands to (1 << x) */ -#define _BV(x) (1 << x) - -void showbits(unsigned char n); - -int main() -{ - unsigned char num; - - printf("Enter an 8-bit number: "); - scanf("%hhu", &num); - - printf("Binary representation: "); - showbits(num); - printf("\n"); - - return 0; -} - -void showbits(unsigned char n) -{ - int i; - unsigned char mask; - - for (i = 7; i >= 0; i--) - { - mask = _BV(i); - if ((n & mask) == 0) - printf("0"); - else - printf("1"); - } -} -``` diff --git a/docs/semester_1/letusc/luc113.md b/docs/semester_1/letusc/luc113.md @@ -1,116 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc113.c' -description: 'Store date in a structure using bit fields (day: 5 bits, month: 4 bits, year: 12 bits). Read joining dates of 10 employees and display them sorted by year.' -source: 'semester_1/letusc/luc113.c' ---- - -# luc113.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Store date in a structure using bit fields (day: 5 bits, month: 4 bits, year: 12 bits). Read joining dates of 10 employees and display them sorted by year. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc113.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc113.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc113.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -// Define structure with bit-fields -struct date -{ - unsigned int day : 5; // 1-31 takes 5 bits - unsigned int month : 4; // 1-12 takes 4 bits - unsigned int year : 12; // Sufficient for year 0-4095 -}; - -struct employee -{ - char name[30]; - struct date doj; // Date of Joining -}; - -int compare_dates(const void *a, const void *b); - -int main() -{ - struct employee emp[10]; - int i; - // Temporary variables for input because we cannot take address of a bit-field - int d, m, y; - - printf("Enter details for 10 employees:\n"); - for (i = 0; i < 10; i++) - { - printf("\nEmployee %d Name: ", i + 1); - scanf("%s", emp[i].name); - - printf("Date of Joining (dd mm yyyy): "); - scanf("%d %d %d", &d, &m, &y); - - // Assign to bit-fields - emp[i].doj.day = d; - emp[i].doj.month = m; - emp[i].doj.year = y; - } - - // Sort based on year using qsort - qsort(emp, 10, sizeof(struct employee), compare_dates); - - printf("\n--- Employees Sorted by Joining Year ---\n"); - for (i = 0; i < 10; i++) - { - printf("%-15s | DOJ: %02d-%02d-%d\n", - emp[i].name, emp[i].doj.day, emp[i].doj.month, emp[i].doj.year); - } - - return 0; -} - -int compare_dates(const void *a, const void *b) -{ - struct employee *e1 = (struct employee *)a; - struct employee *e2 = (struct employee *)b; - - // Primary sort by Year - if (e1->doj.year != e2->doj.year) - return e1->doj.year - e2->doj.year; - - // Secondary sort by Month - if (e1->doj.month != e2->doj.month) - return e1->doj.month - e2->doj.month; - - // Tertiary sort by Day - return e1->doj.day - e2->doj.day; -} -``` diff --git a/docs/semester_1/letusc/luc114.md b/docs/semester_1/letusc/luc114.md @@ -1,93 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc114.c' -description: 'Store insurance policy holder info (gender, minor/major, policy name, duration) using bit-fields.' -source: 'semester_1/letusc/luc114.c' ---- - -# luc114.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Store insurance policy holder info (gender, minor/major, policy name, duration) using bit-fields. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc114.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc114.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc114.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -// Define structure with bit-fields -struct policy_holder -{ - char policy_name[50]; - unsigned int duration : 7; // 0-127 years is sufficient for policy duration - unsigned int gender : 1; // 0: Male, 1: Female (1 bit) - unsigned int status : 1; // 0: Minor, 1: Major (1 bit) -}; - -int main() -{ - struct policy_holder p; - int temp_gen, temp_stat, temp_dur; - - printf("--- Enter Policy Holder Details ---\n"); - - printf("Policy Name: "); - scanf(" %[^\n]s", p.policy_name); // Reads string with spaces - - printf("Duration (Years): "); - scanf("%d", &temp_dur); - p.duration = temp_dur; - - printf("Gender (0 for Male, 1 for Female): "); - scanf("%d", &temp_gen); - p.gender = temp_gen; - - printf("Status (0 for Minor, 1 for Major): "); - scanf("%d", &temp_stat); - p.status = temp_stat; - - printf("\n--- Policy Information Stored ---\n"); - printf("Policy: %s\n", p.policy_name); - printf("Duration: %u years\n", p.duration); - - // Interpret bits for display - printf("Gender: %s\n", (p.gender == 1) ? "Female" : "Male"); - printf("Status: %s\n", (p.status == 1) ? "Major" : "Minor"); - - printf("\nSize of structure: %zu bytes\n", sizeof(p)); - // Note: Size will be policy_name size + padding + integer size containing the bits - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc115.md b/docs/semester_1/letusc/luc115.md @@ -1,241 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc115.c' -description: 'Obtain MD5 checksum of the following strings and check whether they are same: "Six slippery snails slid slowly seaward." "Six silppery snails slid slowly seaward."' -source: 'semester_1/letusc/luc115.c' ---- - -# luc115.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Obtain MD5 checksum of the following strings and check whether they are same: "Six slippery snails slid slowly seaward." "Six silppery snails slid slowly seaward." -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc115.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc115.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc115.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - -/* * Self-contained MD5 Implementation - * Based on the public domain reference implementation (RFC 1321) logic. - */ - -// --- MD5 Implementation Start --- -typedef struct { - uint64_t size; // Size of input in bytes - uint32_t buffer[4]; // Current accumulation of hash - uint8_t input[64]; // Input to be processed -} MD5Context; - -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -#define ROTL(x, s) (((x) << (s)) | ((x) >> (32 - (s)))) - -#define STEP(f, a, b, c, d, x, t, s) \ - (a) += f((b), (c), (d)) + (x) + (t); \ - (a) = ROTL((a), (s)); \ - (a) += (b); - -void md5Transform(uint32_t state[4], const uint8_t block[64]) { - uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - int i, j; - - // Decode block into x - for (i = 0, j = 0; j < 64; i++, j += 4) - x[i] = ((uint32_t)block[j]) | (((uint32_t)block[j + 1]) << 8) | - (((uint32_t)block[j + 2]) << 16) | (((uint32_t)block[j + 3]) << 24); - - // Round 1 - STEP(F, a, b, c, d, x[0], 0xd76aa478, 7); - STEP(F, d, a, b, c, x[1], 0xe8c7b756, 12); - STEP(F, c, d, a, b, x[2], 0x242070db, 17); - STEP(F, b, c, d, a, x[3], 0xc1bdceee, 22); - STEP(F, a, b, c, d, x[4], 0xf57c0faf, 7); - STEP(F, d, a, b, c, x[5], 0x4787c62a, 12); - STEP(F, c, d, a, b, x[6], 0xa8304613, 17); - STEP(F, b, c, d, a, x[7], 0xfd469501, 22); - STEP(F, a, b, c, d, x[8], 0x698098d8, 7); - STEP(F, d, a, b, c, x[9], 0x8b44f7af, 12); - STEP(F, c, d, a, b, x[10], 0xffff5bb1, 17); - STEP(F, b, c, d, a, x[11], 0x895cd7be, 22); - STEP(F, a, b, c, d, x[12], 0x6b901122, 7); - STEP(F, d, a, b, c, x[13], 0xfd987193, 12); - STEP(F, c, d, a, b, x[14], 0xa679438e, 17); - STEP(F, b, c, d, a, x[15], 0x49b40821, 22); - - // Round 2 - STEP(G, a, b, c, d, x[1], 0xf61e2562, 5); - STEP(G, d, a, b, c, x[6], 0xc040b340, 9); - STEP(G, c, d, a, b, x[11], 0x265e5a51, 14); - STEP(G, b, c, d, a, x[0], 0xe9b6c7aa, 20); - STEP(G, a, b, c, d, x[5], 0xd62f105d, 5); - STEP(G, d, a, b, c, x[10], 0x02441453, 9); - STEP(G, c, d, a, b, x[15], 0xd8a1e681, 14); - STEP(G, b, c, d, a, x[4], 0xe7d3fbc8, 20); - STEP(G, a, b, c, d, x[9], 0x21e1cde6, 5); - STEP(G, d, a, b, c, x[14], 0xc33707d6, 9); - STEP(G, c, d, a, b, x[3], 0xf4d50d87, 14); - STEP(G, b, c, d, a, x[8], 0x455a14ed, 20); - STEP(G, a, b, c, d, x[13], 0xa9e3e905, 5); - STEP(G, d, a, b, c, x[2], 0xfcefa3f8, 9); - STEP(G, c, d, a, b, x[7], 0x676f02d9, 14); - STEP(G, b, c, d, a, x[12], 0x8d2a4c8a, 20); - - // Round 3 - STEP(H, a, b, c, d, x[5], 0xfffa3942, 4); - STEP(H, d, a, b, c, x[8], 0x8771f681, 11); - STEP(H, c, d, a, b, x[11], 0x6d9d6122, 16); - STEP(H, b, c, d, a, x[14], 0xfde5380c, 23); - STEP(H, a, b, c, d, x[1], 0xa4beea44, 4); - STEP(H, d, a, b, c, x[4], 0x4bdecfa9, 11); - STEP(H, c, d, a, b, x[7], 0xf6bb4b60, 16); - STEP(H, b, c, d, a, x[10], 0xbebfbc70, 23); - STEP(H, a, b, c, d, x[13], 0x289b7ec6, 4); - STEP(H, d, a, b, c, x[0], 0xeaa127fa, 11); - STEP(H, c, d, a, b, x[3], 0xd4ef3085, 16); - STEP(H, b, c, d, a, x[6], 0x04881d05, 23); - STEP(H, a, b, c, d, x[9], 0xd9d4d039, 4); - STEP(H, d, a, b, c, x[12], 0xe6db99e5, 11); - STEP(H, c, d, a, b, x[15], 0x1fa27cf8, 16); - STEP(H, b, c, d, a, x[2], 0xc4ac5665, 23); - - // Round 4 - STEP(I, a, b, c, d, x[0], 0xf4292244, 6); - STEP(I, d, a, b, c, x[7], 0x432aff97, 10); - STEP(I, c, d, a, b, x[14], 0xab9423a7, 15); - STEP(I, b, c, d, a, x[5], 0xfc93a039, 21); - STEP(I, a, b, c, d, x[12], 0x655b59c3, 6); - STEP(I, d, a, b, c, x[3], 0x8f0ccc92, 10); - STEP(I, c, d, a, b, x[10], 0xffeff47d, 15); - STEP(I, b, c, d, a, x[1], 0x85845dd1, 21); - STEP(I, a, b, c, d, x[8], 0x6fa87e4f, 6); - STEP(I, d, a, b, c, x[15], 0xfe2ce6e0, 10); - STEP(I, c, d, a, b, x[6], 0xa3014314, 15); - STEP(I, b, c, d, a, x[13], 0x4e0811a1, 21); - STEP(I, a, b, c, d, x[4], 0xf7537e82, 6); - STEP(I, d, a, b, c, x[11], 0xbd3af235, 10); - STEP(I, c, d, a, b, x[2], 0x2ad7d2bb, 15); - STEP(I, b, c, d, a, x[9], 0xeb86d391, 21); - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; -} - -void md5Init(MD5Context *ctx) { - ctx->size = 0; - ctx->buffer[0] = 0x67452301; - ctx->buffer[1] = 0xefcdab89; - ctx->buffer[2] = 0x98badcfe; - ctx->buffer[3] = 0x10325476; -} - -void md5Update(MD5Context *ctx, const uint8_t *input, size_t inputLen) { - size_t i, index, partLen; - index = (size_t)((ctx->size >> 3) & 0x3f); - ctx->size += (uint64_t)inputLen * 8; - partLen = 64 - index; - - if (inputLen >= partLen) { - memcpy(&ctx->input[index], input, partLen); - md5Transform(ctx->buffer, ctx->input); - for (i = partLen; i + 63 < inputLen; i += 64) - md5Transform(ctx->buffer, &input[i]); - index = 0; - } else { - i = 0; - } - memcpy(&ctx->input[index], &input[i], inputLen - i); -} - -void md5Final(uint8_t digest[16], MD5Context *ctx) { - uint8_t bits[8]; - size_t index, padLen; - static const uint8_t PADDING[64] = {0x80}; // Remaining zeros implicit - - // Save number of bits - for (int i = 0; i < 8; i++) - bits[i] = (uint8_t)((ctx->size >> (i * 8)) & 0xff); - - index = (size_t)((ctx->size >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - md5Update(ctx, PADDING, padLen); - md5Update(ctx, bits, 8); - - // Encode state into digest - for (int i = 0; i < 16; i++) - digest[i] = (uint8_t)((ctx->buffer[i >> 2] >> ((i & 3) * 8)) & 0xff); -} -// --- MD5 Implementation End --- - -void print_hash(uint8_t *digest) { - for (int i = 0; i < 16; i++) printf("%02x", digest[i]); - printf("\n"); -} - -int main() { - char str1[] = "Six slippery snails slid slowly seaward."; - char str2[] = "Six silppery snails slid slowly seaward."; // Typo 'silppery' - - uint8_t hash1[16], hash2[16]; - MD5Context ctx; - - printf("String 1: %s\n", str1); - md5Init(&ctx); - md5Update(&ctx, (uint8_t*)str1, strlen(str1)); - md5Final(hash1, &ctx); - printf("MD5: "); - print_hash(hash1); - - printf("\nString 2: %s\n", str2); - md5Init(&ctx); - md5Update(&ctx, (uint8_t*)str2, strlen(str2)); - md5Final(hash2, &ctx); - printf("MD5: "); - print_hash(hash2); - - // Compare - int same = 1; - for(int i=0; i<16; i++) if(hash1[i] != hash2[i]) same = 0; - - printf("\nConclusion: The MD5 checksums are %s.\n", same ? "IDENTICAL" : "DIFFERENT"); - if (!same) printf("(Even a small change in input creates a completely different hash)\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc116.md b/docs/semester_1/letusc/luc116.md @@ -1,200 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc116.c' -description: 'Compile any C program into a .EXE or a .out file. Obtain SHA256 checksum of the file.' -source: 'semester_1/letusc/luc116.c' ---- - -# luc116.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Compile any C program into a .EXE or a .out file. Obtain SHA256 checksum of the file. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc116.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc116.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc116.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - -/* * Self-contained SHA-256 Implementation - * Based on FIPS 180-2 reference logic. - */ - -// --- SHA256 Implementation Start --- -typedef struct { - uint8_t data[64]; - uint32_t datalen; - uint64_t bitlen; - uint32_t state[8]; -} SHA256_CTX; - -#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b)))) -#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) -#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22)) -#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25)) -#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3)) -#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10)) - -static const uint32_t K[64] = { - 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, - 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, - 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, - 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, - 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, - 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, - 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, - 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 -}; - -void sha256_transform(SHA256_CTX *ctx, const uint8_t data[]) { - uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; - - for (i = 0, j = 0; i < 16; ++i, j += 4) - m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]); - for (; i < 64; ++i) - m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16]; - - a = ctx->state[0]; b = ctx->state[1]; c = ctx->state[2]; d = ctx->state[3]; - e = ctx->state[4]; f = ctx->state[5]; g = ctx->state[6]; h = ctx->state[7]; - - for (i = 0; i < 64; ++i) { - t1 = h + EP1(e) + CH(e, f, g) + K[i] + m[i]; - t2 = EP0(a) + MAJ(a, b, c); - h = g; g = f; f = e; e = d + t1; - d = c; c = b; b = a; a = t1 + t2; - } - - ctx->state[0] += a; ctx->state[1] += b; ctx->state[2] += c; ctx->state[3] += d; - ctx->state[4] += e; ctx->state[5] += f; ctx->state[6] += g; ctx->state[7] += h; -} - -void sha256_init(SHA256_CTX *ctx) { - ctx->datalen = 0; - ctx->bitlen = 0; - ctx->state[0] = 0x6a09e667; ctx->state[1] = 0xbb67ae85; - ctx->state[2] = 0x3c6ef372; ctx->state[3] = 0xa54ff53a; - ctx->state[4] = 0x510e527f; ctx->state[5] = 0x9b05688c; - ctx->state[6] = 0x1f83d9ab; ctx->state[7] = 0x5be0cd19; -} - -void sha256_update(SHA256_CTX *ctx, const uint8_t data[], size_t len) { - for (size_t i = 0; i < len; ++i) { - ctx->data[ctx->datalen] = data[i]; - ctx->datalen++; - if (ctx->datalen == 64) { - sha256_transform(ctx, ctx->data); - ctx->bitlen += 512; - ctx->datalen = 0; - } - } -} - -void sha256_final(SHA256_CTX *ctx, uint8_t hash[]) { - uint32_t i = ctx->datalen; - if (ctx->datalen < 56) { - ctx->data[i++] = 0x80; - while (i < 56) ctx->data[i++] = 0x00; - } else { - ctx->data[i++] = 0x80; - while (i < 64) ctx->data[i++] = 0x00; - sha256_transform(ctx, ctx->data); - memset(ctx->data, 0, 56); - } - - ctx->bitlen += ctx->datalen * 8; - ctx->data[63] = ctx->bitlen; - ctx->data[62] = ctx->bitlen >> 8; - ctx->data[61] = ctx->bitlen >> 16; - ctx->data[60] = ctx->bitlen >> 24; - ctx->data[59] = ctx->bitlen >> 32; - ctx->data[58] = ctx->bitlen >> 40; - ctx->data[57] = ctx->bitlen >> 48; - ctx->data[56] = ctx->bitlen >> 56; - sha256_transform(ctx, ctx->data); - - for (i = 0; i < 4; ++i) { - hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; - hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; - hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; - hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; - hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; - hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; - hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; - hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; - } -} -// --- SHA256 Implementation End --- - -int main(int argc, char *argv[]) { - FILE *fp; - char filename[100]; - uint8_t buffer[1024]; - size_t bytesRead; - SHA256_CTX ctx; - uint8_t hash[32]; - int i; - - // Get filename - if (argc < 2) { - printf("Enter filename to checksum (e.g., this_program.exe): "); - scanf("%s", filename); - } else { - strcpy(filename, argv[1]); - } - - fp = fopen(filename, "rb"); // Open in binary mode - if (fp == NULL) { - printf("Error: Could not open file '%s'\n", filename); - return 1; - } - - sha256_init(&ctx); - - while ((bytesRead = fread(buffer, 1, sizeof(buffer), fp)) > 0) { - sha256_update(&ctx, buffer, bytesRead); - } - - sha256_final(&ctx, hash); - fclose(fp); - - printf("SHA256 Checksum of '%s':\n", filename); - for (i = 0; i < 32; i++) { - printf("%02x", hash[i]); - } - printf("\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc117.md b/docs/semester_1/letusc/luc117.md @@ -1,119 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc117.c' -description: 'Write a program to convert a given text into an audio file using OpenAI Audio API (TTS).' -source: 'semester_1/letusc/luc117.c' ---- - -# luc117.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to convert a given text into an audio file using OpenAI Audio API (TTS). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc117.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc117.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc117.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <curl/curl.h> - -/* Pre-requisites: - 1. Install libcurl development package. - 2. Get OpenAI API Key. -*/ - -#define API_KEY "YOUR_OPENAI_API_KEY_HERE" - -size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) { - size_t written = fwrite(ptr, size, nmemb, stream); - return written; -} - -int main(void) { - CURL *curl; - CURLcode res; - FILE *fp; - - // JSON Payload construction - const char *url = "https://api.openai.com/v1/audio/speech"; - const char *data = "{" - "\"model\": \"tts-1\"," - "\"input\": \"Hello! This is a C program talking to you.\"," - "\"voice\": \"alloy\"" - "}"; - - struct curl_slist *headers = NULL; - char auth_header[100]; - sprintf(auth_header, "Authorization: Bearer %s", API_KEY); - - curl_global_init(CURL_GLOBAL_ALL); - curl = curl_easy_init(); - - if(curl) { - // Set Headers - headers = curl_slist_append(headers, "Content-Type: application/json"); - headers = curl_slist_append(headers, auth_header); - - // Open file to save audio - fp = fopen("output_audio.mp3", "wb"); - if(!fp) { - printf("Error opening file for writing.\n"); - return 1; - } - - // Configure CURL - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); - - // Perform Request - printf("Sending request to OpenAI TTS API...\n"); - res = curl_easy_perform(curl); - - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); - else - printf("Audio saved to 'output_audio.mp3' successfully.\n"); - - // Cleanup - fclose(fp); - curl_slist_free_all(headers); - curl_easy_cleanup(curl); - } - - curl_global_cleanup(); - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc118.md b/docs/semester_1/letusc/luc118.md @@ -1,98 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc118.c' -description: 'Write a program to generate 4 images of birds flying in the sky with a computer''s mouse in their beak using OpenAI Image API.' -source: 'semester_1/letusc/luc118.c' ---- - -# luc118.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to generate 4 images of birds flying in the sky with a computer's mouse in their beak using OpenAI Image API. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc118.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc118.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc118.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <curl/curl.h> - -/* Pre-requisites: - 1. Install libcurl. - 2. Get OpenAI API Key. -*/ - -#define API_KEY "YOUR_OPENAI_API_KEY_HERE" - -int main(void) { - CURL *curl; - CURLcode res; - - const char *url = "https://api.openai.com/v1/images/generations"; - - // JSON Payload: 4 images, 1024x1024 - const char *data = "{" - "\"prompt\": \"Birds flying in the sky with a computer mouse in their beak\"," - "\"n\": 4," - "\"size\": \"1024x1024\"" - "}"; - - struct curl_slist *headers = NULL; - char auth_header[100]; - sprintf(auth_header, "Authorization: Bearer %s", API_KEY); - - curl = curl_easy_init(); - if(curl) { - headers = curl_slist_append(headers, "Content-Type: application/json"); - headers = curl_slist_append(headers, auth_header); - - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - - // For simplicity, we print the JSON response to stdout. - // The response will contain URLs to the generated images. - printf("Sending request to OpenAI Image API...\n\n"); - res = curl_easy_perform(curl); - - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); - - printf("\n\nCheck the JSON output above for 'url' fields to view images.\n"); - - curl_slist_free_all(headers); - curl_easy_cleanup(curl); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/luc119.md b/docs/semester_1/letusc/luc119.md @@ -1,104 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> luc119.c' -description: 'Write a program to analyse a given sentence to detect the mood of the sentence using OpenAI Chat Completion API.' -source: 'semester_1/letusc/luc119.c' ---- - -# luc119.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 08 Feb 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to analyse a given sentence to detect the mood of the sentence using OpenAI Chat Completion API. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/luc119.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/luc119.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [luc119.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <curl/curl.h> - -/* Pre-requisites: - 1. Install libcurl. - 2. Get OpenAI API Key. -*/ - -#define API_KEY "YOUR_OPENAI_API_KEY_HERE" - -int main(void) { - CURL *curl; - CURLcode res; - - const char *url = "https://api.openai.com/v1/chat/completions"; - - /* We construct the JSON payload manually. - System prompt instructs the model to detect mood. - User prompt is the sentence to analyze. - */ - const char *data = "{" - "\"model\": \"gpt-3.5-turbo\"," - "\"messages\": [" - " {\"role\": \"system\", \"content\": \"You are a helpful assistant. Analyze the mood of the user input sentence. Return only the mood keywords (e.g., admiration, appreciation, anger, joy).\"}," - " {\"role\": \"user\", \"content\": \"I am so impressed by your performance\"}" - "]" - "}"; - - struct curl_slist *headers = NULL; - char auth_header[100]; - sprintf(auth_header, "Authorization: Bearer %s", API_KEY); - - curl = curl_easy_init(); - if(curl) { - headers = curl_slist_append(headers, "Content-Type: application/json"); - headers = curl_slist_append(headers, auth_header); - - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - - printf("Analyzing sentence: 'I am so impressed by your performance'\n"); - printf("Waiting for OpenAI response...\n\n"); - - // The response will be printed to standard output - res = curl_easy_perform(curl); - - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); - - printf("\n\n(Parse the JSON above to extract the 'content' field)\n"); - - curl_slist_free_all(headers); - curl_easy_cleanup(curl); - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem001.md b/docs/semester_1/letusc/lucproblem001.md @@ -1,71 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem001.c' -description: '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.' -source: 'semester_1/letusc/lucproblem001.c' ---- - -# lucproblem001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem001.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/lucproblem002.md b/docs/semester_1/letusc/lucproblem002.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem002.c' -description: 'A year is entered through the keyboard, write a program to determine whether the year is leap or not. Use the logical operators && and || .' -source: 'semester_1/letusc/lucproblem002.c' ---- - -# lucproblem002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -A year is entered through the keyboard, write a program to determine whether the year is leap or not. Use the logical operators && and || . -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem002.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/lucproblem003.md b/docs/semester_1/letusc/lucproblem003.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem003.c' -description: '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' -source: 'semester_1/letusc/lucproblem003.c' ---- - -# lucproblem003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem003.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/lucproblem004.md b/docs/semester_1/letusc/lucproblem004.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem004.c' -description: '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.' -source: 'semester_1/letusc/lucproblem004.c' ---- - -# lucproblem004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem004.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/lucproblem005.md b/docs/semester_1/letusc/lucproblem005.md @@ -1,76 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem005.c' -description: '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.' -source: 'semester_1/letusc/lucproblem005.c' ---- - -# lucproblem005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem005.c] -#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 - } -} -``` diff --git a/docs/semester_1/letusc/lucproblem006.md b/docs/semester_1/letusc/lucproblem006.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem006.c' -description: 'Write a program to find the factorial value of any number entered through the keyboard.' -source: 'semester_1/letusc/lucproblem006.c' ---- - -# lucproblem006.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the factorial value of any number entered through the keyboard. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem006.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/lucproblem007.md b/docs/semester_1/letusc/lucproblem007.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem007.c' -description: 'Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another' -source: 'semester_1/letusc/lucproblem007.c' ---- - -# lucproblem007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem007.c] -#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; -} -``` diff --git a/docs/semester_1/letusc/lucproblem008.md b/docs/semester_1/letusc/lucproblem008.md @@ -1,76 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem008.c' -description: 'Write a problem to print all the prime numbers from 1 to 300.' -source: 'semester_1/letusc/lucproblem008.c' ---- - -# lucproblem008.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a problem to print all the prime numbers from 1 to 300. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem008.c] -#include <stdio.h> -#include <math.h> -#include <stdbool.h> - -#define LIMIT 300 - -int main() -{ - printf("Prime numbers from 1 to 300 : 2"); // as 2 is the only even prime number - for (int i = 3; i <= LIMIT; i += 2) // skipping all other even number - { - int n = (int)sqrt(i); - bool prime = true; - - for (int j = 3; j <= n; j += 2) - // an odd number is only devisable by another odd number. - // so, skipping even number. - { - if (i % j == 0) - { - prime = false; - break; - } - } - if (prime) - { - printf(" %d", i); - } - } - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem009.md b/docs/semester_1/letusc/lucproblem009.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem009.c' -description: 'Write a program to add first seven terms of the following series using a for loop. 1 / 1! + 2 / 2! + 3 / 3! + ...' -source: 'semester_1/letusc/lucproblem009.c' ---- - -# lucproblem009.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to add first seven terms of the following series using a for loop. 1 / 1! + 2 / 2! + 3 / 3! + ... -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem009.c] -#include <stdio.h> -#define N 7 // update N here - -int main() -{ - double sum = 0; int fact = 1; - for (int i = 1; i <= N; i++) - { - fact *= i; - sum += (double)i / fact; - } - printf("Sum of the series : %g", sum); - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem010-complex.md b/docs/semester_1/letusc/lucproblem010-complex.md @@ -1,94 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem010-complex.c' -description: 'Write a program to generate all combinations (permutations) of 1, 2 and 3 from 1-digit numbers up to 4-digit numbers using a main loop to control the number of digits (1 to 3333).' -source: 'semester_1/letusc/lucproblem010-complex.c' ---- - -# lucproblem010-complex.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to generate all combinations (permutations) of 1, 2 and 3 from 1-digit numbers up to 4-digit numbers using a main loop to control the number of digits (1 to 3333). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem010-complex.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem010-complex.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem010-complex.c] -#include <stdio.h> - -// --- RECURSIVE FUNCTION TO ACHIEVE DYNAMIC NESTING --- -// current_digit: The digit being placed in the current position (1, 2, or 3) -// target_length: The total length of the number we are building (e.g., 3 for 3-digit numbers) -// current_number: The integer value built so far -// current_length: How many digits have been placed so far -void generate_combinations(int target_length, int current_number, int current_length) -{ - - // Base Case 1: The number is complete. Print it and return. - if (current_length == target_length) - { - printf(" %d", current_number); - return; - } - - // Recursive Step: Try placing the next digit (1, 2, or 3) - // The for loop now iterates through the *possible values* for the next digit. - for (int next_digit = 1; next_digit <= 3; next_digit++) - { - - // Build the new number: old_number * 10 + next_digit - int new_number = current_number * 10 + next_digit; - - // Recurse: Try to place the next digit - generate_combinations(target_length, new_number, current_length + 1); - } -} - -int main() -{ - printf("Combination of 1, 2 and 3 (1-digit up to 4-digits):\n"); - - /* This outer loop achieves the structure you were going for: - iterating through the required number of digits (1, 2, 3, 4). - */ - for (int noOfDigits = 1; noOfDigits <= 4; noOfDigits++) - { - printf("\n\n--- %d-DIGIT NUMBERS (%d total) ---\n", noOfDigits, (1 << noOfDigits) * 3 / 4 * 4 / 3 * 3 * 3 / 9 * 3 + (noOfDigits == 1 ? 0 : 9) + (noOfDigits == 2 ? 0 : 9) + (noOfDigits == 3 ? 0 : 81) + (noOfDigits == 4 ? 0 : 0) + (noOfDigits == 1 ? 3 : 0) + (noOfDigits == 2 ? 9 : 0) + (noOfDigits == 3 ? 27 : 0) + (noOfDigits == 4 ? 81 : 0)); // Prints the count 3, 9, 27, or 81 - - // Start the recursive generation for the current length - generate_combinations(noOfDigits, 0, 0); - } - - printf("\n\nTotal permutations generated: 120\n"); - - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem010.md b/docs/semester_1/letusc/lucproblem010.md @@ -1,95 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem010.c' -description: 'Write a program to generate all combination of 1, 2 and 3 using for loop.' -source: 'semester_1/letusc/lucproblem010.c' ---- - -# lucproblem010.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to generate all combination of 1, 2 and 3 using for loop. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem010.c] -#include <stdio.h> - -int main() -{ - printf("Combination of 1, 2 and 3 :"); - - // for 1 digit numbers - for (int i = 1; i <= 3; i++) - { - printf(" %d", i); - } - - // for 2 digit numbers - for (int i = 1; i <= 3; i++) - { - for (int j = 1; j <= 3; j++) - { - printf(" %d%d", i, j); - } - } - - // for 3 digit numbers - for (int i = 1; i <= 3; i++) - { - for (int j = 1; j <= 3; j++) - { - for (int k = 1; k <= 3; k++) - { - printf(" %d%d%d", i, j, k); - } - } - } - - // for 4 digit numbers - for (int i = 1; i <= 3; i++) - { - for (int j = 1; j <= 3; j++) - { - for (int k = 1; k <= 3; k++) - { - for (int l = 1; l <= 3; l++) - { - printf(" %d%d%d%d", i, j, k, l); - } - } - } - } - - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem011.md b/docs/semester_1/letusc/lucproblem011.md @@ -1,227 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem011.c' -description: 'Write a menu driven program which has following options : 1. Factorial of a number 2. Prime or not 3. Odd or even 4. Exit Once a menu item is selected the appropriate action should be taken and once this action is finished, the menu should reappear. Unless the user selects the ''Exit'' option the program should continue work.' -source: 'semester_1/letusc/lucproblem011.c' ---- - -# lucproblem011.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a menu driven program which has following options : 1. Factorial of a number 2. Prime or not 3. Odd or even 4. Exit Once a menu item is selected the appropriate action should be taken and once this action is finished, the menu should reappear. Unless the user selects the 'Exit' option the program should continue work. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem011.c] -#include <stdio.h> -#include <math.h> -#include <stdlib.h> -#include <stdbool.h> - -// Function to clear the input buffer after scanf to prevent issues in the next input. -void clearInputBuffer() -{ - int c; - while ((c = getchar()) != '\n' && c != EOF) - ; -} - -// Calculates the factorial of the input number. -void factorial(int num) -{ - // Factorial is not defined for negative numbers. - if (num < 0) - { - printf("\nFactorial is not defined for negative numbers."); - return; - } - // Checks for input over 20 to prevent long long integer overflow (20! is max safe). - if (num > 20) - { - printf("\nFactorial of %d is too large to calculate (max safe integer factorial is 20!).", num); - return; - } - long long fact = 1; - // Calculate factorial iteratively. - for (int i = 1; i <= num; i++) - { - fact *= i; - } - printf("\nFactorial of %d = %lld", num, fact); - return; -} - -// Checks if the input number is a prime number. -void prime(int num) -{ - // Handle special cases: 1 and 2. - if (num == 1) - { - printf("\nInput 1 is NOT a PRIME NUMBER."); - return; - } - else if (num == 2) - { - printf("\nInput 2 is a PRIME NUMBER. (Fact : 2 is only even prime number)"); - return; - } - // Exclude all other even numbers. - if (num % 2 == 0) - { - printf("\nInput %d is NOT a PRIME NUMBER.", num); - return; - } - // Optimization: Only check divisors up to the square root of num. - int endCheckDigit = sqrt(num); - bool isPrime = true; - // Check only odd divisors (i += 2) starting from 3. - for (int i = 3; i <= endCheckDigit; i += 2) - { - if (num % i == 0) - { - printf("\nInput %d is NOT a PRIME NUMBER.", num); - isPrime = false; - break; - } - } - if (isPrime) - { - printf("\nInput %d is a PRIME NUMBER.", num); - return; - } -} - -// Checks if the input number is odd or even. -void oddoreven(int num) -{ - // A number is even if it is perfectly divisible by 2. - if (num % 2 == 0) - { - printf("\nInput %d is a EVEN NUMBER.", num); - return; - } - else - { - printf("\nInput %d is a ODD NUMBER.", num); - return; - } -} - -// Main function: displays the menu and controls program flow. -int main() -{ - int choice, num; - // Infinite loop ensures the menu reappears after every operation until 'Exit' is chosen. - while (1) - { - // Display menu options. - printf("\n\n===== MENU =====" - "\n1. Factorial of a number" - "\n2. Prime or not" - "\n3. Odd or Even" - "\n4. Exit"); - printf("\nEnter your choice : "); - - // Input validation for menu choice. - if (scanf("%d", &choice) != 1) - { - printf("\nPlease enter a number."); - clearInputBuffer(); - continue; - } - clearInputBuffer(); - - // Handle menu selection using switch-case. - switch (choice) - { - case 1: - printf("\n=== FACTORIAL OF A NUMBER ==="); - printf("\nEnter the number : "); - // Input validation for the number to be factored. - if (scanf("%d", &num) != 1) - { - printf("\nPlease enter a number."); - clearInputBuffer(); - continue; - } - clearInputBuffer(); - factorial(num); - break; - case 2: - printf("\n=== PRIME OR NOT ==="); - printf("\nEnter the number : "); - // Input validation for the number to be checked. - if (scanf("%d", &num) != 1) - { - printf("\nPlease enter a number."); - clearInputBuffer(); - continue; - } - clearInputBuffer(); - // Require a non-negative, non-zero number for prime check. - if (num < 0) - { - printf("\nPlease enter a postive number."); - continue; - } - else if (num == 0) - { - printf("\nPlease enter a non-zero number."); - continue; - } - prime(num); - break; - case 3: - printf("\n=== ODD OR EVEN ==="); - printf("\nEnter the number : "); - // Input validation for the number to be checked. - if (scanf("%d", &num) != 1) - { - printf("\nPlease enter a number."); - clearInputBuffer(); - continue; - } - clearInputBuffer(); - oddoreven(num); - break; - case 4: - // Exit the program cleanly. - printf("\nExiting the program.\n\nSAYONARA...\n\n"); - exit(0); - default: - // Handle invalid menu choice input. - printf("\nPlease enter a valid choice."); - break; - } - } -} -``` diff --git a/docs/semester_1/letusc/lucproblem012.md b/docs/semester_1/letusc/lucproblem012.md @@ -1,71 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem012.c' -description: 'Write a Function power(a, b), to calculate the value of a raised to b' -source: 'semester_1/letusc/lucproblem012.c' ---- - -# lucproblem012.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a Function power(a, b), to calculate the value of a raised to b -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem012.c] -#include <stdio.h> - -double power(double, int); - -double power(double a, int b) -{ - if (b == 0) - return 1; - double res = 1; - int i; - if (b > 0) - for (i = 1; i <= b; i++) - res *= a; - return res; -} - -int main() -{ - double a, result; - int b; - printf("Enter the value and the power (Format A^B) : "); - scanf("%lf^%d", &a, &b); - result = power(a, b); - printf("Result of %g^%d = %g", a, b, result); - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem013.md b/docs/semester_1/letusc/lucproblem013.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem013.c' -description: 'Define a function to convert any given year into its Roman equivalent. Use these roman equivalent for decimal numbers : 1 - I, 5 - V, 10 - X, 50 - L, 100 - C, 500 - D, 1000 - M' -source: 'semester_1/letusc/lucproblem013.c' ---- - -# lucproblem013.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Define a function to convert any given year into its Roman equivalent. Use these roman equivalent for decimal numbers : 1 - I, 5 - V, 10 - X, 50 - L, 100 - C, 500 - D, 1000 - M -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem013.c] -#include <stdio.h> - -void romanise(int); - -void romanise(int year) -{ - int values[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; - const char *romanChar[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; - // including the two-character subtractive pairs. - int i = 0; - - printf("Year %d = ", year); - while (year > 0) - { - if (year >= values[i]) - { - printf("%s", romanChar[i]); - year -= values[i]; - } - else - i++; - } -} - -int main() -{ - int year; - printf("Enter the year : "); - scanf("%d", &year); - romanise(year); - return 0; -} -``` diff --git a/docs/semester_1/letusc/lucproblem014-short.md b/docs/semester_1/letusc/lucproblem014-short.md @@ -1,100 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem014-short.c' -description: 'Write a function that receives integers and returns the sum, average and standard deviation of these numbers. Call this function from main() and print the result in main()' -source: 'semester_1/letusc/lucproblem014-short.c' ---- - -# lucproblem014-short.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function that receives integers and returns the sum, average and standard deviation of these numbers. Call this function from main() and print the result in main() -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem014-short.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem014-short.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem014-short.c] -#include <stdio.h> -#include <math.h> - -void stats(double *, double *, double *); - -int main() -{ - double sum, average, standardDeviation; - stats(&sum, &average, &standardDeviation); - - printf("\n--- Stats ---" - "\nSum: %g" - "\nAverage: %g" - "\nStandard Deviation: %g", - sum, average, standardDeviation); - return 0; -} - -void stats(double *sum, double *average, double *standardDeviation) -{ - int n; - printf("How many numbers you want to give input: "); - scanf("%d", &n); - - double inputNumber[n]; - int i; - - printf("\n--- Enter Numbers ---\n"); - for (i = 0; i < n; i++) - { - printf("Enter number %d: ", i + 1); - scanf("%lf", &inputNumber[i]); - } - - double tempSum = 0; - for (i = 0; i < n; i++) - tempSum += inputNumber[i]; - - double tempAverage = tempSum / n; - - double tempStandardDeviation = 0.0; - - if (n > 1) - { - double tempSumation = 0; - for (i = 0; i < n; i++) - tempSumation += pow((inputNumber[i] - tempAverage), 2.0); - - tempStandardDeviation = sqrt(tempSumation / (n - 1)); - } - - *sum = tempSum; - *average = tempAverage; - *standardDeviation = tempStandardDeviation; -} -``` diff --git a/docs/semester_1/letusc/lucproblem014.md b/docs/semester_1/letusc/lucproblem014.md @@ -1,142 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem014.c' -description: 'Write a function that receives integers and returns the sum, average and standard deviation of these numbers. Call this function from main() and print the result in main()' -source: 'semester_1/letusc/lucproblem014.c' ---- - -# lucproblem014.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function that receives integers and returns the sum, average and standard deviation of these numbers. Call this function from main() and print the result in main() -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem014.c] -#include <stdio.h> -#include <math.h> - -// Function prototype: Using pointers for 'call by reference' to return 3 values. -void stats(double *, double *, double *); - -int main() -{ - double sum, average, standardDeviation; - // Passing addresses of variables to receive results from the function. - stats(&sum, &average, &standardDeviation); - - printf("\n--- Stats ---" - "\nSum: %g" - "\nAverage: %g" - "\nStandard Deviation: %g", - sum, average, standardDeviation); - return 0; -} - -// Function to calculate statistics on user-provided numbers. -void stats(double *sum, double *average, double *standardDeviation) -{ - int n; - // Input Validation Loop for N - do - { - printf("How many numbers you want to give input: "); - - if (scanf("%d", &n) == 1) - { - break; - } - else - { - printf("\nPlease enter a valid number.\n"); - // Clearing input buffer to handle invalid input - while (getchar() != '\n' && !feof(stdin)) - ; - } - } while (1); - - // Variable-Length Array (VLA) to store the input numbers. - double inputNumber[n]; - int i = 0; - - printf("\n--- Enter Numbers ---\n"); - - // Input Loop for numbers - while (i < n) - { - printf("Enter number %d: ", i + 1); - - if (scanf("%lf", &inputNumber[i]) == 1) - { - // Clearing input buffer after successful read - while (getchar() != '\n') - ; - i++; - } - else - { - printf("Invalid input. Only integers are allowed. Please try again.\n"); - // Clearing input buffer to handle invalid input - while (getchar() != '\n' && !feof(stdin)) - ; - } - } - - // 1. Sum Calculation - double tempSum = 0; - for (i = 0; i < n; i++) - tempSum += inputNumber[i]; - - // 2. Average (Mean) calculation - double tempAverage = tempSum / n; - - // 3. Standard Deviation (Sample SD formula used) - double tempStandardDeviation = 0.0; - - // Preventing division by zero if n is 1. SD is 0 for a single number. - if (n > 1) - { - double tempSumation = 0; - // calculating the sum of squared differences from the mean - for (i = 0; i < n; i++) - tempSumation += pow((inputNumber[i] - tempAverage), 2.0); - - // Calculating sample standard deviation - tempStandardDeviation = sqrt(tempSumation / (n - 1)); - } - - // Assigning final values back to the variables in main(). - *sum = tempSum; - *average = tempAverage; - *standardDeviation = tempStandardDeviation; -} -``` diff --git a/docs/semester_1/letusc/lucproblem015.md b/docs/semester_1/letusc/lucproblem015.md @@ -1,85 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem015.c' -description: 'Write a program that defines a function that calculates power of one number reaised to another and factorial value of a number in one cell.' -source: 'semester_1/letusc/lucproblem015.c' ---- - -# lucproblem015.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program that defines a function that calculates power of one number reaised to another and factorial value of a number in one cell. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem015.c] -#include <stdio.h> - -void bothPowerFactorial(double, int, int, double *, long long *); - -int main() -{ - double a, resultPower; - int b, factN; - long long resultFactorial; - printf("Enter a and b for calculating a raised to b: "); - scanf("%lf %d", &a, &b); - printf("Enter number to calculate the factorial: "); - scanf("%d", &factN); - if (b < 0 || factN < 0) - { - printf("\nOnly non-negative integer is allowed as input of b and factorial."); - return 1; - } - bothPowerFactorial(a, b, factN, &resultPower, &resultFactorial); - printf("\n%g Raised to %d: %g" - "\nFactorial of %d: %lld", - a, b, resultPower, factN, resultFactorial); - return 0; -} - -void bothPowerFactorial(double a, int b, int n, double *resultPower, long long *resultFactorial) -{ - double tempResultPower = 1; - long long tempResultFactorial = 1; - int i; - - for (i = 1; i <= b; i++) - tempResultPower *= a; - - for (i = 1; i <= n; i++) - tempResultFactorial *= i; - - *resultPower = tempResultPower; - *resultFactorial = tempResultFactorial; -} -``` diff --git a/docs/semester_1/letusc/lucproblem016.md b/docs/semester_1/letusc/lucproblem016.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> lucproblem016.c' -description: 'Figure 9.4 shows three memory locations and values stored in them. Write a program to declare variables that implement the relationship shown. How will you print the values and addresses shown in the figure? On which machine the program should be executed to get such addresses? Figure 9.4: value: 3.14, memory_address: 7fff9489c79c value: 7fff9489c7a0, memory_address: 7fff4fd134b8 value: 7fff9489c79c, memory_address: 7fff9489c7a0' -source: 'semester_1/letusc/lucproblem016.c' ---- - -# lucproblem016.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Figure 9.4 shows three memory locations and values stored in them. Write a program to declare variables that implement the relationship shown. How will you print the values and addresses shown in the figure? On which machine the program should be executed to get such addresses? Figure 9.4: value: 3.14, memory_address: 7fff9489c79c value: 7fff9489c7a0, memory_address: 7fff4fd134b8 value: 7fff9489c79c, memory_address: 7fff9489c7a0 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/letusc/lucproblem016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/letusc/lucproblem016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [lucproblem016.c] -#include <stdio.h> - -int main() -{ - float a = 3.14; - float *c = &a; - float **b = &c; - - printf("Location 1 (Variable a):\n"); - printf("Value: %g\n", a); - printf("Address: %p\n", (void *)&a); - printf("------------------------------\n"); - - printf("Location 3 (Variable c: float *):\n"); - printf("Value (Address stored): %p\n", (void *)c); - printf("Address of c itself: %p\n", (void *)&c); - printf("Value pointed to (*c): %g\n", *c); - printf("------------------------------\n"); - - printf("Location 2 (Variable b: float **):\n"); - printf("Value (Address stored): %p\n", (void *)b); - printf("Address of b itself: %p\n", (void *)&b); - printf("Value pointed to (*b): %p\n", (void *)*b); - printf("Value pointed to (**b): %g\n", **b); - printf("------------------------------\n"); - - return 0; -} -``` diff --git a/docs/semester_1/practice-c/external_1.md b/docs/semester_1/practice-c/external_1.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_1.c' -description: 'C program — external_1.c' -source: 'semester_1/practice-c/external_1.c' ---- - -# external_1.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_1.c] -#include<stdio.h> - -int sum(int); -int product(int); - -int main() { - int num; - printf("Enter a positive integer: "); - scanf("%d", &num); - printf("\nSum of the integer is %d", sum(num)); - printf("\nProduct of the integer is %d", product(num)); - return 0; -} - -int sum(int num) { - int s = 0; - while (num != 0) { - s += num % 10; - num = num / 10; - } - return s; -} - -int product(int num) { - int pro = 1; - while(num != 0) { - pro *= num % 10; - num /= 10; - } - return pro; -} -``` diff --git a/docs/semester_1/practice-c/external_2.md b/docs/semester_1/practice-c/external_2.md @@ -1,53 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_2.c' -description: 'C program — external_2.c' -source: 'semester_1/practice-c/external_2.c' ---- - -# external_2.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_2.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_2.c] -#include<stdio.h> - -int reverse(int); - -int main() { - int num; - printf("\nEnter a non-negative integer: "); - scanf("%d", &num); - if(num < 0) num = -num; - printf("\nReverse number: %d", reverse(num)); - return 0; -} - -int reverse(int num) { - int rev = 0; - while(num > 0) { - rev = (rev * 10) + num % 10; - num/= 10; - } - return rev; -} -``` diff --git a/docs/semester_1/practice-c/external_3.md b/docs/semester_1/practice-c/external_3.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_3.c' -description: 'C program — external_3.c' -source: 'semester_1/practice-c/external_3.c' ---- - -# external_3.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_3.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_3.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_3.c] -#include<stdio.h> - -int sum(int); - -int main() { - int n; - printf("Enter the value for n: "); - scanf("%d", &n); - printf("\nSum of the first n terms= %d", sum(n)); - return 0; -} - -int sum(int n) { - int i, res = 0; - for(i = 1; i <= n; i++) { - if(i % 2 == 0) { - res -= i; - continue; - } - res += i; - } - return res; -} -``` diff --git a/docs/semester_1/practice-c/external_4.md b/docs/semester_1/practice-c/external_4.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_4.c' -description: 'C program — external_4.c' -source: 'semester_1/practice-c/external_4.c' ---- - -# external_4.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_4.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_4.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_4.c] -#include<stdio.h> - -int isPrime(int); - -int main() { - int num, i; - printf("Enter the number: "); - scanf("%d", &num); - if(isPrime(num)) printf("\n%d is a prime number.", num); - else printf("\n%d is not a prime number.", num); - - // generate prime numbers upto 100 - printf("\n\nPrime number upto 100: "); - for(i = 1; i <= 100; i++) { - if(isPrime(i)) printf("\n%d ", i); - } - return 0; -} - -int isPrime(int n) { - int i; - if(n == 2) return 1; - if(n <= 1 || n % 2 == 0) return 0; - for(i = 3; i * i <= n; i = i+2) if(n % i == 0) return 0; - return 1; -} -``` diff --git a/docs/semester_1/practice-c/external_5.md b/docs/semester_1/practice-c/external_5.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_5.c' -description: 'C program — external_5.c' -source: 'semester_1/practice-c/external_5.c' ---- - -# external_5.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_5.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_5.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_5.c] -#include<stdio.h> -#include<string.h> -#include<ctype.h> - -int isPalindrome(char []); - -int main() { - char str[50]; - printf("Enter the string (upto 50 char): "); - fgets(str, sizeof(str), stdin); - if(str[strlen(str) - 1] == '\n') str[strlen(str) - 1] = '\0'; - if(isPalindrome(str)) printf("\n\"%s\" is palindrome.", str); - else printf("\n\"%s\" is not palindrome.", str); - return 0; -} - -int isPalindrome(char str[]) { - int len = strlen(str); - int start = 0, end = len - 1; - while(start < end) { - if(tolower(*(str + start)) != tolower(*(str + end))) return 0; - start++; - end--; - } - return 1; -} -``` diff --git a/docs/semester_1/practice-c/external_6.md b/docs/semester_1/practice-c/external_6.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_6.c' -description: 'C program — external_6.c' -source: 'semester_1/practice-c/external_6.c' ---- - -# external_6.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_6.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_6.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_6.c] -#include<stdio.h> - -void factor(int); - -int main() { - int n; - printf("Enter a number: "); - scanf("%d", &n); - factor(n); - return 0; -} - -void factor(int n) { - int i; - printf("\nThe factors of %d = ", n); - if(n == 0) { - printf("Infinite."); - return; - } - if (n < 0) n = -n; - for(i = 1; i <= n; i++) { - if(n % i == 0) { - printf("%d %d ", i, -i); - } - } -} -``` diff --git a/docs/semester_1/practice-c/external_7.md b/docs/semester_1/practice-c/external_7.md @@ -1,50 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_7.c' -description: 'C program — external_7.c' -source: 'semester_1/practice-c/external_7.c' ---- - -# external_7.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_7.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_7.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_7.c] -#include<stdio.h> - -#define SWAP(a, b) \ - do { \ - __typeof__(a) temp = a; \ - a = b; \ - b = temp; \ - } while (0) \ - -int main() { - int a, b; - printf("Enter two number: "); - scanf("%d %d", &a, &b); - printf("\nA = \'%d\', B = \'%d\'", a, b); - SWAP(a, b); - printf("\nA = \'%d\', B = \'%d\'", a, b); - return 0; -} -``` diff --git a/docs/semester_1/practice-c/external_8.md b/docs/semester_1/practice-c/external_8.md @@ -1,51 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> external_8.c' -description: 'C program — external_8.c' -source: 'semester_1/practice-c/external_8.c' ---- - -# external_8.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/external_8.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/external_8.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [external_8.c] -#include <stdio.h> - -int main() { - int rows, i, j, k; - - printf("Enter the number of lines: "); - scanf("%d", &rows); - - for (i = 1; i <= rows; i++) { - for(j = 1; j <= rows - i; j++) { - printf(" "); - } - for (k = 1; k <= i; k++) { - printf("* "); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/practice-c/index.md b/docs/semester_1/practice-c/index.md @@ -1,54 +0,0 @@ -# Practice C - -Files and sub-folders in **Practice C**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `external_1.c` | [View Code](external_1.md) | -| 2 | `external_2.c` | [View Code](external_2.md) | -| 3 | `external_3.c` | [View Code](external_3.md) | -| 4 | `external_4.c` | [View Code](external_4.md) | -| 5 | `external_5.c` | [View Code](external_5.md) | -| 6 | `external_6.c` | [View Code](external_6.md) | -| 7 | `external_7.c` | [View Code](external_7.md) | -| 8 | `external_8.c` | [View Code](external_8.md) | -| 9 | `pc-ip-01.c` | [View Code](pc-ip-01.md) | -| 10 | `pc-ip-02.c` | [View Code](pc-ip-02.md) | -| 11 | `pc-ip-03.c` | [View Code](pc-ip-03.md) | -| 12 | `pc-ip-04.c` | [View Code](pc-ip-04.md) | -| 13 | `pc-ip-05.c` | [View Code](pc-ip-05.md) | -| 14 | `pc-ip-06.c` | [View Code](pc-ip-06.md) | -| 15 | `pc-ip-07.c` | [View Code](pc-ip-07.md) | -| 16 | `pc-ip-08.c` | [View Code](pc-ip-08.md) | -| 17 | `pc-ip-09.c` | [View Code](pc-ip-09.md) | -| 18 | `pc-ip-10.c` | [View Code](pc-ip-10.md) | -| 19 | `pc-ip-11.c` | [View Code](pc-ip-11.md) | -| 20 | `pc-ip-12.c` | [View Code](pc-ip-12.md) | -| 21 | `pc-ip-13.c` | [View Code](pc-ip-13.md) | -| 22 | `pc-ip-14.c` | [View Code](pc-ip-14.md) | -| 23 | `pc-ip-15.c` | [View Code](pc-ip-15.md) | -| 24 | `pc-ip-16.c` | [View Code](pc-ip-16.md) | -| 25 | `pc-ip-17.c` | [View Code](pc-ip-17.md) | -| 26 | `pc-ip-18.c` | [View Code](pc-ip-18.md) | -| 27 | `pc-ip-19.c` | [View Code](pc-ip-19.md) | -| 28 | `pc-ip-20.c` | [View Code](pc-ip-20.md) | -| 29 | `pc001.c` | [View Code](pc001.md) | -| 30 | `pc002.c` | [View Code](pc002.md) | -| 31 | `pc003.c` | [View Code](pc003.md) | -| 32 | `pc004.c` | [View Code](pc004.md) | -| 33 | `pc005.c` | [View Code](pc005.md) | -| 34 | `pc006.c` | [View Code](pc006.md) | -| 35 | `pc007.c` | [View Code](pc007.md) | -| 36 | `pc008.c` | [View Code](pc008.md) | -| 37 | `pc009.c` | [View Code](pc009.md) | -| 38 | `pc010.c` | [View Code](pc010.md) | -| 39 | `pc011.c` | [View Code](pc011.md) | -| 40 | `pc012.c` | [View Code](pc012.md) | -| 41 | `pc013.c` | [View Code](pc013.md) | -| 42 | `pc014.c` | [View Code](pc014.md) | -| 43 | `pc015.c` | [View Code](pc015.md) | -| 44 | `pc016.c` | [View Code](pc016.md) | -| 45 | `pc017.c` | [View Code](pc017.md) | - diff --git a/docs/semester_1/practice-c/pc-ip-01.md b/docs/semester_1/practice-c/pc-ip-01.md @@ -1,85 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-01.c' -description: 'Question 1: Write a program to compute the sum and product of digits of an integer using user-defined functions.' -source: 'semester_1/practice-c/pc-ip-01.c' ---- - -# pc-ip-01.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 1: Write a program to compute the sum and product of digits of an integer using user-defined functions. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-01.c] -#include <stdio.h> - -int sum(int); -int product(int); - -int main() -{ - int num; - printf("Enter the number: "); - scanf("%d", &num); - printf("\nSum of digit: %d", sum(num)); - printf("\nProduct of digit: %d", product(num)); - return 0; -} - -int sum(int num) -{ - int result = 0; - while (num > 0) - { - result += num % 10; - num /= 10; - } - return result; -} - -int product(int num) -{ - int result = 1; - if (num == 0) - { - return 0; - } - while (num > 0) - { - result *= num % 10; - num /= 10; - } - return result; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-02.md b/docs/semester_1/practice-c/pc-ip-02.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-02.c' -description: 'Question 2: Write a program to reverse a non-negative integer using a function.' -source: 'semester_1/practice-c/pc-ip-02.c' ---- - -# pc-ip-02.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 2: Write a program to reverse a non-negative integer using a function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-02.c] -#include <stdio.h> - -int reverse(int); - -int main() -{ - int num; - printf("Enter the number: "); - scanf("%d", &num); - if (num < 0) - { - printf("\nOnly poitive integers are allowed."); - return 1; - } - printf("\nReverse of input %d is : %d", num, reverse(num)); - return 0; -} - -int reverse(int num) -{ - int result = 0; - while (num > 0) - { - result = (result * 10) + (num % 10); - num /= 10; - } - return result; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-03.md b/docs/semester_1/practice-c/pc-ip-03.md @@ -1,74 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-03.c' -description: 'Question 3: Write a program to compute the sum of the first n terms of the series using a function: S=1-2+3-4+5-6+...' -source: 'semester_1/practice-c/pc-ip-03.c' ---- - -# pc-ip-03.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 3: Write a program to compute the sum of the first n terms of the series using a function: S=1-2+3-4+5-6+... -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-03.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-03.c] -#include <stdio.h> - -int series(int); - -int main() -{ - int n; - printf("Enter the n: "); - scanf("%d", &n); - printf("\nSum of the series: %d", series(n)); - return 0; -} - -int series(int n) -{ - int i, result = 0; - for (i = 1; i <= n; i++) - { - if (i % 2 == 0) - { - result -= i; - } - else - { - result += i; - } - } - return result; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-04.md b/docs/semester_1/practice-c/pc-ip-04.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-04.c' -description: 'Question 4: Write a function to check whether a number is prime or not. Use the same function to generate all prime numbers less than 100.' -source: 'semester_1/practice-c/pc-ip-04.c' ---- - -# pc-ip-04.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 4: Write a function to check whether a number is prime or not. Use the same function to generate all prime numbers less than 100. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-04.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-04.c] -#include <stdio.h> -#include <math.h> - -int isPrime(int); - -int main() -{ - int n, i; - printf("Enter the number: "); - scanf("%d", &n); - if (isPrime(n)) - { - printf("\nInput %d is a prime number.", n); - } - else - { - printf("\nInput %d is not a prime number.", n); - } - printf("\nPrime numbers from 1 to 100:"); - for (i = 1; i <= 100; i++) - { - if (isPrime(i)) - { - printf(" %d", i); - } - } - return 0; -} - -int isPrime(int n) -{ - int i; - int end = (int)sqrt(n); - if (n == 0 || n == 1) - { - return 0; - } - for (i = 2; i <= end; i++) - { - if (n % i == 0) - { - return 0; - } - } - return 1; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-05.md b/docs/semester_1/practice-c/pc-ip-05.md @@ -1,89 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-05.c' -description: 'Question 5: Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome.' -source: 'semester_1/practice-c/pc-ip-05.c' ---- - -# pc-ip-05.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 5: Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-05.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-05.c] -#include <stdio.h> - -int isPalindrome(char[]); - -int main() -{ - char str[51]; - printf("Please enter the string (Max: 50 character): "); - gets(str); - if (isPalindrome(str)) - { - printf("\nInput string is a palindrome string."); - } - else - { - printf("\ninput string is not a palindrome string."); - } - return 0; -} - -int isPalindrome(char str[]) -{ - int low = 0; - int high = 0; - while (str[high] != '\0') - { - high++; - } - high--; - if (low == high) - { - return 1; - } - while (low < high) - { - if (str[low] != str[high]) - { - return 0; - } - low++; - high--; - } - return 1; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-06.md b/docs/semester_1/practice-c/pc-ip-06.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-06.c' -description: 'Question 6: Write a program using a function to compute and display all factors of a given number.' -source: 'semester_1/practice-c/pc-ip-06.c' ---- - -# pc-ip-06.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 6: Write a program using a function to compute and display all factors of a given number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-06.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-06.c] -#include <stdio.h> - -void printFactors(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - printFactors(n); - return 0; -} - -void printFactors(int n) -{ - int i; - printf("\nFactors of %d:", n); - for (i = 1; i <= n; i++) - { - if (n % i == 0) - { - printf(" %d", i); - } - } -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-07.md b/docs/semester_1/practice-c/pc-ip-07.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-07.c' -description: 'Question 7: Write a program to swap two numbers using pointers using user-defined function.' -source: 'semester_1/practice-c/pc-ip-07.c' ---- - -# pc-ip-07.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 7: Write a program to swap two numbers using pointers using user-defined function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-07.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-07.c] -#include <stdio.h> - -void swap(int *, int *); - -int main() -{ - int a, b; - printf("Enter two number: "); - scanf("%d %d", &a, &b); - printf("\nBefore Swap: "); - printf("\nA = %d, Loc: %p", a, &a); - printf("\nB = %d, Loc: %p", b, &b); - swap(&a, &b); - printf("\nAfter Swap: "); - printf("\nA = %d, Loc: %p", a, &a); - printf("\nB = %d, Loc: %p", b, &b); - return 0; -} - -void swap(int *a, int *b) -{ - int temp = *a; - *a = *b; - *b = temp; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-08.md b/docs/semester_1/practice-c/pc-ip-08.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-08.c' -description: 'Question 8: Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main().' -source: 'semester_1/practice-c/pc-ip-08.c' ---- - -# pc-ip-08.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 8: Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main(). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-08.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-08.c] -#include <stdio.h> -#include <math.h> - -void area_circumference(double, double *, double *); - -int main() -{ - double r, area, cir; - printf("Enter the radius of the circle: "); - scanf("%lf", &r); - area_circumference(r, &area, &cir); - printf("\nArea of the circle: %g", area); - printf("\nCircumference of the circle: %g", cir); - return 0; -} - -void area_circumference(double r, double *area, double *cir) -{ - *area = M_PI * r * r; - *cir = 2 * M_PI * r; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-09.md b/docs/semester_1/practice-c/pc-ip-09.md @@ -1,107 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-09.c' -description: 'Question 9: Write a program to find the sum of n elements entered by the user. Use dynamic memory allocation (malloc() or calloc()).' -source: 'semester_1/practice-c/pc-ip-09.c' ---- - -# pc-ip-09.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 9: Write a program to find the sum of n elements entered by the user. Use dynamic memory allocation (malloc() or calloc()). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-09.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-09.c] -#include <stdio.h> -#include <stdlib.h> - -void inputArray(double[], int); -void printArray(double[], int); -double sum(double[], int); - -int main() -{ - int n; - double *arr = NULL; - printf("Enter the number of element: "); - scanf("%d", &n); - arr = (double *)malloc(n * sizeof(double)); - if (arr == NULL) - { - printf("\nMemory allocation failed."); - return 1; - } - inputArray(arr, n); - printf("\nGiven Array: "); - printArray(arr, n); - printf("\nSum of the elements of the array: %g", sum(arr, n)); - free(arr); - return 0; -} - -void inputArray(double arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%lf", &arr[i]); - } -} - -void printArray(double arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%g", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); -} - -double sum(double arr[], int n) -{ - int i; - double sum = 0; - for (i = 0; i < n; i++) - { - sum += arr[i]; - } - return sum; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-10.md b/docs/semester_1/practice-c/pc-ip-10.md @@ -1,112 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-10.c' -description: 'Question 10: Write a function that reverses each elements of an array in place, using only a single pointer argument, and return void.' -source: 'semester_1/practice-c/pc-ip-10.c' ---- - -# pc-ip-10.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 10: Write a function that reverses each elements of an array in place, using only a single pointer argument, and return void. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-10.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-10.c] -#include <stdio.h> -#include <stdlib.h> - -void inputArray(int[], int); -void printArray(int[], int); -void reverse(int *); - -int main() -{ - int n, i, *arr = NULL; - printf("Enter the number of element: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - if (arr == NULL) - { - printf("\nMemory allocation failed."); - return 1; - } - inputArray(arr, n); - printf("\nGiven Array: "); - printArray(arr, n); - for (i = 0; i < n; i++) - { - reverse(&arr[i]); - } - printf("\nUpdated Array: "); - printArray(arr, n); - free(arr); - return 0; -} - -void inputArray(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void printArray(int arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); -} - -void reverse(int *n) -{ - int temp = *n; - int rev = 0; - while (temp > 0) - { - rev = (rev * 10) + (temp % 10); - temp /= 10; - } - *n = rev; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-11.md b/docs/semester_1/practice-c/pc-ip-11.md @@ -1,141 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-11.c' -description: 'Question 11: Write a program to merge two sorted integer arrays to form a single sorted array.' -source: 'semester_1/practice-c/pc-ip-11.c' ---- - -# pc-ip-11.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 11: Write a program to merge two sorted integer arrays to form a single sorted array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-11.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-11.c] -#include <stdio.h> -#include <stdlib.h> - -void merge(int[], int, int[], int); -void inputArray(int[], int); -void printArray(int[], int); - -int main() -{ - int a, b, *arra = NULL, *arrb = NULL; - printf("Enter the number of element for array A and B: "); - scanf("%d %d", &a, &b); - arra = (int *)malloc(a * sizeof(int)); - if (arra == NULL) - { - printf("\nMemory Allocation failed."); - return 1; - } - arrb = (int *)malloc(b * sizeof(int)); - if (arrb == NULL) - { - printf("\nMemory Allocation failed."); - return 1; - } - printf("\nEnter element for array A:\n"); - inputArray(arra, a); - printf("\nEnter element for array B:\n"); - inputArray(arrb, b); - printf("\nGiven array A: "); - printArray(arra, a); - printf("\nGiven array b: "); - printArray(arrb, b); - merge(arra, a, arrb, b); - free(arra); - free(arrb); - return 0; -} - -void inputArray(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void printArray(int arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); -} - -void merge(int arra[], int a, int arrb[], int b) -{ - int i, j, k, *arr = NULL, n = a + b; - arr = (int *)malloc(n * sizeof(int)); - if (arr == NULL) - { - printf("\nMemory Allocation failed."); - return; - } - i = j = k = 0; - while (i < a && j < b) - { - if (arra[i] < arrb[j]) - { - arr[k++] = arra[i++]; - } - else - { - arr[k++] = arrb[j++]; - } - } - while (i < a) - { - arr[k++] = arra[i++]; - } - while (j < b) - { - arr[k++] = arrb[j++]; - } - printf("\nMerged Array: "); - printArray(arr, n); - free(arr); -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-12.md b/docs/semester_1/practice-c/pc-ip-12.md @@ -1,120 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-12.c' -description: 'Question 12: Write a program that reads 10 integers into an array (using pointers), and prints the array in ascending and descending order.' -source: 'semester_1/practice-c/pc-ip-12.c' ---- - -# pc-ip-12.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 12: Write a program that reads 10 integers into an array (using pointers), and prints the array in ascending and descending order. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-12.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-12.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-12.c] -#include <stdio.h> - -void input(int *); -void bubble_sort(int[], int); - -int main() -{ - int arr[10], i, n = 10; - input(arr); - printf("\nGiven Array: "); - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); - bubble_sort(arr, n); - printf("\nAscending Order: "); - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); - printf("\nDescending Order: "); - printf("["); - for (i = n - 1; i >= 0; i--) - { - printf("%d", arr[i]); - if (i > 0) - { - printf(", "); - } - } - printf("]"); - return 0; -} - -void input(int *arr) -{ - int i; - for (i = 0; i < 10; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", arr + i); - } -} - -void bubble_sort(int arr[], int n) -{ - int isSwaped = 1; - int i, j, temp; - for (i = 0; (i < n) && isSwaped; i++) - { - isSwaped = 0; - for (j = 0; j < n - 1 - i; j++) - { - if (arr[j] > arr[j + 1]) - { - temp = arr[j]; - arr[j] = arr[j + 1]; - arr[j + 1] = temp; - isSwaped = 1; - } - } - } -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-13.md b/docs/semester_1/practice-c/pc-ip-13.md @@ -1,103 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-13.c' -description: 'Question 13: Write a program to display the Fibonacci series using recursive function and iterative function.' -source: 'semester_1/practice-c/pc-ip-13.c' ---- - -# pc-ip-13.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 13: Write a program to display the Fibonacci series using recursive function and iterative function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-13.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-13.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-13.c] -#include <stdio.h> - -long long int fib_rec(int); -void fib_rec_print(int); -void fib_ite_print(int); - -int main() -{ - int n; - printf("Enter the number of terms: "); - scanf("%d", &n); - fib_rec_print(n); - fib_ite_print(n); - return 0; -} - -void fib_rec_print(int n) -{ - int i; - printf("\nFibonacci Series (Recursion):"); - for (i = 0; i <= n; i++) - { - printf(" %lld", fib_rec(i)); - } -} - -void fib_ite_print(int n) -{ - int i, t1 = 0, t2 = 1, t3; - printf("\nFibonacci Series (iteration):"); - if (n > 0) - { - printf(" 0"); - } - if (n > 1) - { - printf(" 1"); - } - for (i = 2; i <= n; i++) - { - t3 = t1 + t2; - printf(" %d", t3); - t1 = t2; - t2 = t3; - } -} - -long long int fib_rec(int n) -{ - if (n == 0 || n == 1) - { - return n; - } - else - { - return fib_rec(n - 1) + fib_rec(n - 2); - } -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-14.md b/docs/semester_1/practice-c/pc-ip-14.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-14.c' -description: 'Question 14: Write a program to calculate the factorial of a number using recursive and iterative function.' -source: 'semester_1/practice-c/pc-ip-14.c' ---- - -# pc-ip-14.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 14: Write a program to calculate the factorial of a number using recursive and iterative function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-14.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-14.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-14.c] -#include <stdio.h> - -long long int fact_rec(int); -long long int fact_ite(int); - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - printf("\nFactorial of %d (Recursion): %lld", n, fact_rec(n)); - printf("\nFactorial of %d (Iteration): %lld", n, fact_ite(n)); - return 0; -} - -long long int fact_ite(int n) -{ - int i, pd = 1; - for (i = 1; i <= n; i++) - { - pd *= i; - } - return pd; -} - -long long int fact_rec(int n) -{ - if (n == 0) - { - return 1; - } - else - { - return n * fact_rec(n - 1); - } -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-15.md b/docs/semester_1/practice-c/pc-ip-15.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-15.c' -description: 'Question 15: Write a program to calculate the GCD of two numbers using recursive and iterative function.' -source: 'semester_1/practice-c/pc-ip-15.c' ---- - -# pc-ip-15.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 15: Write a program to calculate the GCD of two numbers using recursive and iterative function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-15.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-15.c] -#include <stdio.h> - -int gcd_rec(int, int); -int gcd_ite(int, int); - -int main() -{ - int a, b; - printf("Enter two number: "); - scanf("%d %d", &a, &b); - printf("\nGCD(%d, %d) (Recursion) = %d", a, b, gcd_rec(a, b)); - printf("\nGCD(%d, %d) (Iteration) = %d", a, b, gcd_ite(a, b)); - return 0; -} - -int gcd_ite(int a, int b) -{ - int temp; - while (a != 0) - { - temp = a; - a = b % a; - b = temp; - } - return b; -} - -int gcd_rec(int a, int b) -{ - if (a == 0) - { - return b; - } - else - { - return gcd_rec(b % a, a); - } -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-16.md b/docs/semester_1/practice-c/pc-ip-16.md @@ -1,84 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-16.c' -description: 'Question 16: Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);.' -source: 'semester_1/practice-c/pc-ip-16.c' ---- - -# pc-ip-16.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 16: Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-16.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-16.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-16.c] -#include <stdio.h> -#include <math.h> - -int isArmstrong(int); - -int main() -{ - int num; - printf("Enter the number: "); - scanf("%d", &num); - if (isArmstrong(num)) - { - printf("\nInput %d is a Armstrong number.", num); - } - else - { - printf("\nInput %d is not a Armstrong number.", num); - } - return 0; -} - -int isArmstrong(int num) -{ - int temp = num; - int power = 0; - int result = 0; - while (temp > 0) - { - power++; - temp /= 10; - } - temp = num; - while (temp > 0) - { - result += (int)pow((temp % 10), power); - temp /= 10; - } - return result == num; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-17.md b/docs/semester_1/practice-c/pc-ip-17.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-17.c' -description: 'Question 17: Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);.' -source: 'semester_1/practice-c/pc-ip-17.c' ---- - -# pc-ip-17.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 17: Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-17.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-17.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-17.c] -#include <stdio.h> - -int isPerfect(int); - -int main() -{ - int num; - printf("Enter the number : "); - scanf("%d", &num); - if (isPerfect(num)) - { - printf("\nInput '%d' is a perfect number.", num); - } - else - { - printf("\nInput '%d' is not a perfect number.", num); - } - return 0; -} - -int isPerfect(int n) -{ - int i, sum = 0; - for (i = 1; i <= n / 2; i++) - { - if (n % i == 0) - { - sum += i; - } - } - return sum == n; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-18.md b/docs/semester_1/practice-c/pc-ip-18.md @@ -1,113 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-18.c' -description: 'Question 18: Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);.' -source: 'semester_1/practice-c/pc-ip-18.c' ---- - -# pc-ip-18.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 18: Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-18.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-18.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-18.c] -#include <stdio.h> -#include <stdlib.h> - -int findLargest(int[], int); -void inputArray(int[], int); -void printArray(int[], int); - -int main() -{ - int n, *arr = NULL; - printf("Enter the number of element: "); - scanf("%d", &n); - if (n < 2) - { - printf("\nTo get highest element, there must be atleast 2 element."); - return 1; - } - arr = (int *)malloc(n * sizeof(int)); - if (arr == NULL) - { - printf("\nMemory allocation failed."); - return 1; - } - inputArray(arr, n); - printf("\nGiven Array: "); - printArray(arr, n); - printf("\nLargest element of the array: %d", findLargest(arr, n)); - free(arr); - return 0; -} - -void inputArray(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void printArray(int arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); -} - -int findLargest(int arr[], int size) -{ - int i, largest = arr[0]; - for (i = 1; i < size; i++) - { - if (arr[i] > largest) - { - largest = arr[i]; - } - } - return largest; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-19.md b/docs/semester_1/practice-c/pc-ip-19.md @@ -1,130 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-19.c' -description: 'Question 19: Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);.' -source: 'semester_1/practice-c/pc-ip-19.c' ---- - -# pc-ip-19.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 19: Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-19.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-19.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-19.c] -#include <stdio.h> -#include <stdlib.h> - -int binarySearch(int[], int, int); -void inputArray(int[], int); -void printArray(int[], int); - -int main() -{ - int n, *arr = NULL, target, foundIndex; - printf("Enter the number of element: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - if (arr == NULL) - { - printf("\nMemory allocation failed."); - return 1; - } - printf("\nPlease enter the sorted array element(s): \n"); - inputArray(arr, n); - printf("\nGiven array: "); - printArray(arr, n); - printf("\nPlease enter the target element: "); - scanf("%d", &target); - foundIndex = binarySearch(arr, n, target); - if (foundIndex != -1) - { - printf("\nTarget '%d' found at Index %d.", target, foundIndex); - } - else - { - printf("\nUnable to find target '%d'.", target); - } - free(arr); - return 0; -} - -void inputArray(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void printArray(int arr[], int n) -{ - int i; - printf("["); - for (i = 0; i < n; i++) - { - printf("%d", arr[i]); - if (i < n - 1) - { - printf(", "); - } - } - printf("]"); -} - -int binarySearch(int arr[], int size, int target) -{ - int low = 0; - int high = size - 1; - int mid; - while (low <= high) - { - mid = (low + high) / 2; - if (arr[mid] == target) - { - return mid; - } - else if (arr[mid] > target) - { - high = mid - 1; - } - else if (arr[mid] < target) - { - low = mid + 1; - } - } - return -1; -} -``` diff --git a/docs/semester_1/practice-c/pc-ip-20.md b/docs/semester_1/practice-c/pc-ip-20.md @@ -1,103 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc-ip-20.c' -description: 'Question 20: Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);.' -source: 'semester_1/practice-c/pc-ip-20.c' ---- - -# pc-ip-20.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 05 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Question 20: Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc-ip-20.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc-ip-20.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc-ip-20.c] -#include<stdio.h> -#include<stdlib.h> - -void inputArray(int [], int); -void reverseArray(int [], int); -void printArray(int [], int); - -int main() { - int n, *arr = NULL; - printf("How many element do you want enter: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - if(arr == NULL) { - printf("\nMemory allocation failed."); - return 1; - } - inputArray(arr, n); - printf("\nBefore Reverse: "); - printArray(arr, n); - reverseArray(arr, n); - printf("\nAfter reverse: "); - printArray(arr, n); - free(arr); - return 0; -} - -void inputArray(int arr[], int n) { - int i; - for(i = 0; i < n; i++) { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -void printArray(int arr[], int n) { - int i; - printf("["); - for(i = 0; i < n; i++) { - printf("%d", arr[i]); - if(i < n - 1) { - printf(", "); - } - } - printf("]"); -} - -void reverseArray(int arr[], int size) { - int i = 0; - int j = size - 1; - int temp; - while(i < j) { - temp = arr[i]; - arr[i] = arr[j]; - arr[j] = temp; - i++; - j--; - } -} -``` diff --git a/docs/semester_1/practice-c/pc001.md b/docs/semester_1/practice-c/pc001.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc001.c' -description: 'Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 for n = 5' -source: 'semester_1/practice-c/pc001.c' ---- - -# pc001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 for n = 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc001.c] -#include <stdio.h> -int main() -{ - int i, j, num; - printf("Enter n : "); - scanf("%d", &num); - for (i = 1; i <= num; i++) - { - for (j = 1; j <= i; j++) - { - printf("%d\t", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc002.md b/docs/semester_1/practice-c/pc002.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc002.c' -description: 'Pattern : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 for n = 5' -source: 'semester_1/practice-c/pc002.c' ---- - -# pc002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 for n = 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc002.c] -#include <stdio.h> -int main() -{ - int i, j, n, temp = 1; - printf("Enter n : "); - scanf("%d", &n); - for (i = n; i >= 1; i--) - { - for (j = 1; j <= i; j++) - { - printf("%d\t", temp); - temp++; - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc003.md b/docs/semester_1/practice-c/pc003.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc003.c' -description: 'Pattern : 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 for n = 5' -source: 'semester_1/practice-c/pc003.c' ---- - -# pc003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern : 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 for n = 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc003.c] -#include <stdio.h> -int main() -{ - int i, j, n; - printf("Enter n : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - for (j = 1; j <= i; j++) - { - printf("%d\t", i * j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc004.md b/docs/semester_1/practice-c/pc004.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc004.c' -description: 'Pattern : 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 for n = 5' -source: 'semester_1/practice-c/pc004.c' ---- - -# pc004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern : 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 for n = 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc004.c] -#include <stdio.h> -int main() -{ - int i, j, k, n; - printf("Enter n : "); - scanf("%d", &n); - for (i = n; i >= 1; i--) - { - for (j = 1; j <= i - 1; j++) - { - printf("\t"); - } - for (k = i; k >= 1; k--) - { - printf("%d\t", k); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc005.md b/docs/semester_1/practice-c/pc005.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc005.c' -description: 'Pattern : 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 for n = 5' -source: 'semester_1/practice-c/pc005.c' ---- - -# pc005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern : 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 for n = 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc005.c] -#include <stdio.h> -int main() -{ - int i, j, n; - long long temp1 = 0, temp2 = 1, temp3; - printf("Enter n : "); - scanf("%d", &n); - printf("1\n"); - for (i = 2; i <= n; i++) - { - for (j = 1; j <= i; j++) - { - temp3 = temp1 + temp2; - printf("%lld\t", temp3); - temp1 = temp2; - temp2 = temp3; - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc006.md b/docs/semester_1/practice-c/pc006.md @@ -1,84 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc006.c' -description: 'Prime number check' -source: 'semester_1/practice-c/pc006.c' ---- - -# pc006.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Prime number check -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc006.c] -#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; -} -``` diff --git a/docs/semester_1/practice-c/pc007.md b/docs/semester_1/practice-c/pc007.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc007.c' -description: 'Armstrong number check only for three digit' -source: 'semester_1/practice-c/pc007.c' ---- - -# pc007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Armstrong number check only for three digit -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc007.c] -#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; -} -``` diff --git a/docs/semester_1/practice-c/pc008.md b/docs/semester_1/practice-c/pc008.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc008.c' -description: 'Factorial upto N' -source: 'semester_1/practice-c/pc008.c' ---- - -# pc008.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Factorial upto N -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc008.c] -#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; -} -``` diff --git a/docs/semester_1/practice-c/pc009.md b/docs/semester_1/practice-c/pc009.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc009.c' -description: 'Sum of digit' -source: 'semester_1/practice-c/pc009.c' ---- - -# pc009.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Sum of digit -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc009.c] -#include <stdio.h> -int main() -{ - int num, sumOfDigit = 0, temp; - printf("Enter the number : "); - if (scanf("%d", &num) != 1) - { - printf("\nOnly a number is allowed."); - return 1; - } - temp = num; - while (temp > 0) - { - sumOfDigit += temp % 10; - temp /= 10; - } - printf("\nSum of the digit %d : %d", num, sumOfDigit); - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc010.md b/docs/semester_1/practice-c/pc010.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc010.c' -description: 'Reverse a number' -source: 'semester_1/practice-c/pc010.c' ---- - -# pc010.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Reverse a number -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc010.c] -#include <stdio.h> -int main() -{ - int num, temp, rev = 0; - printf("\nEnter the number : "); - if (scanf("%d", &num) != 1) - { - printf("\nOnly a number is allowed."); - return 1; - } - temp = num; - while (temp > 0) - { - rev = (rev * 10) + (temp % 10); - temp /= 10; - } - printf("\nReverse of the number %d : %d", num, rev); - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc011.md b/docs/semester_1/practice-c/pc011.md @@ -1,89 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc011.c' -description: 'Write a C program that takes two positive integers, L (Lower Bound) and U (Upper Bound), as input from the user. The program must find and print the count of all numbers between L and U (inclusive) that are also a Palindrome Number.' -source: 'semester_1/practice-c/pc011.c' ---- - -# pc011.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that takes two positive integers, L (Lower Bound) and U (Upper Bound), as input from the user. The program must find and print the count of all numbers between L and U (inclusive) that are also a Palindrome Number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc011.c] -#include <stdio.h> -#define true 1 -#define false 0 - -int isPalindrome(int num) -{ - int temp = num, numRev = 0; - while (temp > 0) - { - numRev = (numRev * 10) + (temp % 10); - temp /= 10; - } - if (num == numRev) - return true; - else - return false; -} - -int main() -{ - int uBound, lBound, num, palindromeCount = 0; - printf("Enter the Lower Bound and Upper Bound : "); - if (scanf("%d %d", &lBound, &uBound) != 2) - { - printf("\nOnly Integer values are allowed."); - return 1; - } - if (lBound < 0 || uBound < 0 || lBound > uBound) - { - printf("\nPlease enter appropriate inforamtion."); - return 1; - } - printf("Palindrome Numbers from %d to %d :", lBound, uBound); - for (num = lBound; num <= uBound; num++) - { - if (isPalindrome(num)) - { - printf(" %d", num); - palindromeCount++; - } - } - printf("\nTotal Palindrome number found inside the range (%d to %d) : %d", lBound, uBound, palindromeCount); - return 0; -} -``` diff --git a/docs/semester_1/practice-c/pc012.md b/docs/semester_1/practice-c/pc012.md @@ -1,90 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc012.c' -description: 'Write a C function that receives a string (character array) and uses pointers to count and return the total number of vowels and consonants in that string.' -source: 'semester_1/practice-c/pc012.c' ---- - -# pc012.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C function that receives a string (character array) and uses pointers to count and return the total number of vowels and consonants in that string. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc012.c] -#include <stdio.h> -#include <ctype.h> - -void charCounter(char[], int *, int *); - -int main() -{ - char str[101]; - int vowelCount, consonantCount; - printf("Enter the string (Max: 100 character): "); - if (fgets(str, sizeof(str), stdin) == NULL) - { - printf("Error reading input.\n"); - return 1; - } - charCounter(str, &vowelCount, &consonantCount); - printf("\nVowel Count: %d", vowelCount); - printf("\nConsonant Count: %d", consonantCount); - printf("\nTotal Character: %d", vowelCount + consonantCount); - return 0; -} - -void charCounter(char str[], int *vowelCount, int *consonantCount) -{ - int tempVowelCount = 0, tempConsonantCount = 0; - while (*str != '\0') - { - char ch = tolower(*str); - if (isalpha(ch)) - { - if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') - { - tempVowelCount++; - } - else - { - tempConsonantCount++; - } - } - str++; - } - - *vowelCount = tempVowelCount; - *consonantCount = tempConsonantCount; -} -``` diff --git a/docs/semester_1/practice-c/pc013.md b/docs/semester_1/practice-c/pc013.md @@ -1,118 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc013.c' -description: 'Write a C program that defines a structure named Book with attributes bookID (int), title (string), and price (float). Include a user-defined function named updatePrice with the signature: void updatePrice(struct Book *b, float newPrice); The program should: Accept details for one book from the user. Display the details before the update. Use the function to update the price of the book. Display the updated details.' -source: 'semester_1/practice-c/pc013.c' ---- - -# pc013.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 29 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program that defines a structure named Book with attributes bookID (int), title (string), and price (float). Include a user-defined function named updatePrice with the signature: void updatePrice(struct Book *b, float newPrice); The program should: Accept details for one book from the user. Display the details before the update. Use the function to update the price of the book. Display the updated details. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc013.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -typedef struct Book -{ - int bookID; - float price; - char title[20]; -} Book; - -void acceptDetails(Book *); -void displayDetails(Book *); -void updatePrice(struct Book *, float); - -int main() -{ - Book book1; - float newPrice; - acceptDetails(&book1); - displayDetails(&book1); - printf("\n\nEnter the updated price: "); - if (scanf("%f", &newPrice) != 1) - { - printf("\nInvalid Price!"); - exit(1); - } - updatePrice(&book1, newPrice); - displayDetails(&book1); - return 0; -} - -void acceptDetails(Book *book) -{ - char *p; - printf("\n== Enter details for the book ==\n"); - printf("Enter Book ID: "); - if (scanf("%d", &book->bookID) != 1) - { - printf("\nInvalid Book ID!"); - exit(1); - } - while (getchar() != '\n') - ; - printf("Enter Book Title: "); - if (fgets(book->title, sizeof(book->title), stdin) == NULL) - { - printf("\nError reading input!"); - exit(1); - } - p = strchr(book->title, '\n'); - if (p) - *p = '\0'; - printf("Enter Price: "); - if (scanf("%f", &book->price) != 1) - { - printf("\nInvalid Price!"); - exit(1); - } -} - -void displayDetails(Book *book) -{ - printf("\n== Details of the Book =="); - printf("\nBook ID: %d", book->bookID); - printf("\nBook Title: %s", book->title); - printf("\nBook Price: %g", book->price); -} - -void updatePrice(struct Book *book, float newPrice) -{ - book->price = newPrice; -} -``` diff --git a/docs/semester_1/practice-c/pc014.md b/docs/semester_1/practice-c/pc014.md @@ -1,95 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc014.c' -description: 'Write a c program that defines a structure Student with the following members: roll (int), name (string), and marks (float). Do the below: Create an array to store details for 3 students. Read the details for these 3 student from a file named students.txt. (Assume the file contains data in the format: Roll Name Marks). Implement a recursive function float calculateTotal(struct Student arr[], int n) to calculate the sum of marks of all students in the array. Display each student''s details and the total marks calculated by the recursive function.' -source: 'semester_1/practice-c/pc014.c' ---- - -# pc014.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 30 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a c program that defines a structure Student with the following members: roll (int), name (string), and marks (float). Do the below: Create an array to store details for 3 students. Read the details for these 3 student from a file named students.txt. (Assume the file contains data in the format: Roll Name Marks). Implement a recursive function float calculateTotal(struct Student arr[], int n) to calculate the sum of marks of all students in the array. Display each student's details and the total marks calculated by the recursive function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc014.c] -#include<stdio.h> -#include<stdlib.h> -#include<string.h> - -#define FILENAME "students.txt" - -typedef struct Student { - int roll; - char name[20]; - float marks; -} Stu; - -void printDetails(Stu *, int); -float calculateTotal(struct Student [], int); - -int main() { - FILE *input = NULL; - Stu stu[3]; - int i = 0; - - input = fopen(FILENAME, "r"); - if(input == NULL) { - printf("\nError opening file %s. Please try again.", FILENAME); - exit(1); - } - - while(i < 3 && (fscanf(input, "%d %s %f", &stu[i].roll, &stu[i].name, &stu[i].marks) == 3)) i++; - printDetails(stu, 3); - printf("\n\nTotal Marks: %g", calculateTotal(stu, 3)); - fclose(input); - return 0; -} - -float calculateTotal(struct Student stu[], int n) { - if(n <= 0) { - return 0; - } - return stu[n - 1].marks + calculateTotal(stu, n-1); -} - -void printDetails(Stu *stu, int n) { - int i; - printf("\n== Student Details =="); - for(i = 0; i < n; i++) { - printf("\nStudent Roll: %d" - "\nStudent Name: %s" - "\nStudent Marks: %g\n", - stu[i].roll, stu[i].name, stu[i].marks); - } -} -``` diff --git a/docs/semester_1/practice-c/pc015.md b/docs/semester_1/practice-c/pc015.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc015.c' -description: 'Write a C program to reverse a string using a recursive function.' -source: 'semester_1/practice-c/pc015.c' ---- - -# pc015.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 30 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to reverse a string using a recursive function. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc015.c] -#include<stdio.h> -#include<stdlib.h> -#include<string.h> - -void reverseString(char [], char *, char *); - -int main() { - char string[101], *p, *start, *end; - printf("Enter the string (Max: 100 char): "); - if(fgets(string, sizeof(string), stdin) == NULL) { - printf("\nError reading input."); - exit(1); - } - p = strchr(string, '\n'); - if(p) *p = '\0'; - printf("Before Reverse: %s", string); - start = string; - end = string + strlen(string) - 1; - reverseString(string, start, end); - printf("\nAfter reverse: %s", string); - return 0; -} - -void reverseString(char str[], char *start, char *end) { - if(start >= end) { - return; - } - char temp; - temp = *start; - *start = *end; - *end = temp; - start++; - end--; - reverseString(str, start, end); -} -``` diff --git a/docs/semester_1/practice-c/pc016.md b/docs/semester_1/practice-c/pc016.md @@ -1,151 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc016.c' -description: 'Write a c program that records book data from user and stores them in to a file.' -source: 'semester_1/practice-c/pc016.c' ---- - -# pc016.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 31 Mar 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a c program that records book data from user and stores them in to a file. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc016.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - -#define FILENAME "Library.txt" - -typedef struct Book -{ - int id; - char title[20]; - char author[20]; -}Book; - -void dataInput(Book *, int); -void displayData(Book *, int); -bool writeLog(Book *, int); - -int main() -{ - Book book[3]; - int choice; - - printf("== Enter the data =="); - dataInput(book, 3); - printf("\n\n Data enetered by the user =="); - displayData(book, 3); - - if (writeLog(book, 3)) - { - printf("\n\nSuccessfully written the log into \"%s\"", FILENAME); - return 0; - } else - { - printf("\nError writing log."); - return 1; - } -} - -void dataInput(Book *book, int n) -{ - int i; - char *p; - - for (i = 0; i < n; i++) - { - printf("\nEnter the Book ID: "); - if (scanf("%d", &book[i].id) != 1) - { - printf("\nError reading bookID."); - exit(1); - } - while (getchar() != '\n') - ; - - printf("Enter the Book Title: "); - if (fgets(book[i].title, sizeof(book[i].title), stdin) == NULL) - { - printf("\nError reading title."); - exit(1); - } - p = strchr(book[i].title, '\n'); - if (p) - *p = '\0'; - - printf("Enter the Book Author: "); - if (fgets(book[i].author, sizeof(book[i].author), stdin) == NULL) - { - printf("\nError reading Author."); - exit(1); - } - p = strchr(book[i].author, '\n'); - if (p) - *p = '\0'; - } -} - -void displayData(Book *book, int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("\n\nBook ID: %d" - "\nBook Title: %s" - "\nBook Author: %s", - book[i].id, book[i].title, book[i].author); - } -} - -bool writeLog(Book *book, int n) -{ - int i; - FILE *output = NULL; - output = fopen(FILENAME, "w"); - if (output == NULL) - { - printf("\n\nError writing file \"%s\"", FILENAME); - return false; - } - for (i = 0; i < n; i++) - { - fprintf(output, "%d \'%s\' \'%s\'\n", book[i].id, book[i].title, book[i].author - } - fclose(output); - return true; -} -``` diff --git a/docs/semester_1/practice-c/pc017.md b/docs/semester_1/practice-c/pc017.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> pc017.c' -description: 'Write a program to calculate the difference between two time periods using structures.' -source: 'semester_1/practice-c/pc017.c' ---- - -# pc017.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 21 Apr 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate the difference between two time periods using structures. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/practice-c/pc017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/practice-c/pc017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [pc017.c] -#include <stdio.h> -#include <stdlib.h> - -typedef struct time_reference -{ - int hour; - int min; - int sec; -} timeRef; - -int main() -{ - timeRef a, b; - long long int tSeconds_a, tSeconds_b, timeDiff; - - printf("== Note: Time should be entered in HH-MM-SS 24-hour clock format =="); - printf("\nEnter the time reference a: "); - scanf("%d-%d-%d", &a.hour, &a.min, &a.sec); - printf("Enter the time reference b: "); - scanf("%d-%d-%d", &b.hour, &b.min, &b.sec); - - tSeconds_a = (a.hour * 3600) + (a.min * 60) + a.sec; - tSeconds_b = (b.hour * 3600) + (b.min * 60) + b.sec; - - timeDiff = tSeconds_a - tSeconds_b; - timeDiff = abs(timeDiff); - - printf("\nTime Difference: %lld Hours, %lld Minutes, %lld Seconds.", timeDiff / 3600, (timeDiff % 3600) / 60, (timeDiff % 3600) % 60); - return 0; -} -``` diff --git a/docs/semester_1/temp/index.md b/docs/semester_1/temp/index.md @@ -1,13 +0,0 @@ -# Temp - -Files and sub-folders in **Temp**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `maheswar01.c` | [View Code](maheswar01.md) | -| 2 | `maheswar02.c` | [View Code](maheswar02.md) | -| 3 | `sudipto1.c` | [View Code](sudipto1.md) | -| 4 | `sudiptoown01.c` | [View Code](sudiptoown01.md) | - diff --git a/docs/semester_1/temp/maheswar01.md b/docs/semester_1/temp/maheswar01.md @@ -1,217 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> maheswar01.c' -description: 'C program — maheswar01.c' -source: 'semester_1/temp/maheswar01.c' ---- - -# maheswar01.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/temp/maheswar01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/temp/maheswar01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [maheswar01.c] -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -#define MAX 1000 - -/* ================= STACK FOR OPERATORS ================= */ - -typedef struct { - char data[MAX]; - int top; -} CharStack; - -void initCharStack(CharStack *s) { - s->top = -1; -} - -void pushChar(CharStack *s, char c) { - s->data[++s->top] = c; -} - -char popChar(CharStack *s) { - return s->data[s->top--]; -} - -char peekChar(CharStack *s) { - return s->data[s->top]; -} - -int isEmptyChar(CharStack *s) { - return s->top == -1; -} - -/* ================= STACK FOR NUMBERS ================= */ - -typedef struct { - double data[MAX]; - int top; -} DoubleStack; - -void initDoubleStack(DoubleStack *s) { - s->top = -1; -} - -void pushDouble(DoubleStack *s, double x) { - s->data[++s->top] = x; -} - -double popDouble(DoubleStack *s) { - return s->data[s->top--]; -} - -/* ================= HELPER FUNCTIONS ================= */ - -int precedence(char op) { - if (op == '+' || op == '-') return 1; - if (op == '*' || op == '/') return 2; - return 0; -} - -int isOperator(char c) { - return c == '+' || c == '-' || c == '*' || c == '/'; -} - -/* ================= INFIX TO POSTFIX ================= */ - -void infixToPostfix(const char *infix, char *postfix) { - CharStack stack; - initCharStack(&stack); - - int i = 0, k = 0; - - while (infix[i]) { - if (isspace(infix[i])) { - i++; - continue; - } - - if (isdigit(infix[i]) || infix[i] == '.') { - while (isdigit(infix[i]) || infix[i] == '.') { - postfix[k++] = infix[i++]; - } - postfix[k++] = ' '; - } - else if (infix[i] == '(') { - pushChar(&stack, infix[i]); - i++; - } - else if (infix[i] == ')') { - while (!isEmptyChar(&stack) && peekChar(&stack) != '(') { - postfix[k++] = popChar(&stack); - postfix[k++] = ' '; - } - popChar(&stack); // remove '(' - i++; - } - else if (isOperator(infix[i])) { - while (!isEmptyChar(&stack) && - precedence(peekChar(&stack)) >= precedence(infix[i])) { - postfix[k++] = popChar(&stack); - postfix[k++] = ' '; - } - pushChar(&stack, infix[i]); - i++; - } - else { - printf("Invalid character: %c\n", infix[i]); - exit(1); - } - } - - while (!isEmptyChar(&stack)) { - postfix[k++] = popChar(&stack); - postfix[k++] = ' '; - } - - postfix[k] = '\0'; -} - -/* ================= POSTFIX EVALUATION ================= */ - -double evaluatePostfix(const char *postfix) { - DoubleStack stack; - initDoubleStack(&stack); - - int i = 0; - - while (postfix[i]) { - if (isspace(postfix[i])) { - i++; - continue; - } - - if (isdigit(postfix[i]) || postfix[i] == '.') { - char number[50]; - int k = 0; - - while (isdigit(postfix[i]) || postfix[i] == '.') { - number[k++] = postfix[i++]; - } - number[k] = '\0'; - - pushDouble(&stack, atof(number)); - } - else if (isOperator(postfix[i])) { - double b = popDouble(&stack); - double a = popDouble(&stack); - - switch (postfix[i]) { - case '+': pushDouble(&stack, a + b); break; - case '-': pushDouble(&stack, a - b); break; - case '*': pushDouble(&stack, a * b); break; - case '/': - if (b == 0) { - printf("Error: Division by zero\n"); - exit(1); - } - pushDouble(&stack, a / b); - break; - } - i++; - } - } - - return popDouble(&stack); -} - -/* ================= MAIN ================= */ - -int main() { - char infix[MAX]; - char postfix[MAX]; - - printf("Enter expression: "); - fgets(infix, MAX, stdin); - - infixToPostfix(infix, postfix); - - double result = evaluatePostfix(postfix); - - printf("Result = %.10g\n", result); - - return 0; -} -``` diff --git a/docs/semester_1/temp/maheswar02.md b/docs/semester_1/temp/maheswar02.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> maheswar02.c' -description: 'C program — maheswar02.c' -source: 'semester_1/temp/maheswar02.c' ---- - -# maheswar02.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/temp/maheswar02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/temp/maheswar02.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [maheswar02.c] -#include<stdio.h> -#include<stdlib.h> - -int main() { - FILE *fIn, *fEven, *fOdd; - int n; - - fIn = fopen("input.txt", "r"); - fEven = fopen("EVENFile.txt", "w"); - fOdd = fopen("ODDFile.txt", "w"); - - // Check if files opened successfully - if ((fIn == NULL) || (fEven == NULL) || (fOdd == NULL)) { - printf("ERROR : one or more file opening FAILED!"); - if (fIn != NULL) fclose(fIn); - if (fEven != NULL) fclose(fEven); - if (fOdd != NULL) fclose(fOdd); - exit(1); - } - - // Read numbers and separate them into even and odd files - while (fscanf(fIn, "%d", &n) != EOF) - (n % 2 == 0) ? fprintf(fEven, "%d\n", n) : fprintf(fOdd, "%d\n", n); - - // Close all files - fclose(fIn); - fclose(fEven); - fclose(fOdd); - - printf("OPERATION COMPLETED SUCCESSFULLY."); - return 0; -} -``` diff --git a/docs/semester_1/temp/sudipto1.md b/docs/semester_1/temp/sudipto1.md @@ -1,163 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> sudipto1.c' -description: 'A smart home security controller monitors the state of several sensors to decide what action to take. Each second, the system reads data from sensors that can either be active or inactive. Based on the current state of all sensors, the controller must perform exactly one action, such as activating a warning, checking a specific zone, or declaring an intrusion. Write a C program that reads the sensor states as input and prints the corresponding system action. -- Conditions: 1. You must determine exactly one action for every possible combination of sensor states. 2. You are not allowed to use any conditional statements (if, else if, else, or the ternary operator?). 3. You are not allowed to use logical operators. 4. You must use a single switch statement to control the program''s behaviour. 5. Loops may only be used for reading input, not for making decisions. 6. The program should handle all possible combinations of the sensors'' active/inactive states and print the appropriate response each time. -- Example (for understanding): If all sensors are inactive, the system should remain idle. If some sensors are active, the system should issue warnings or alerts based on the situation. If all sensors are active, the system should declare a confirmed intrusion.' -source: 'semester_1/temp/sudipto1.c' ---- - -# sudipto1.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -A smart home security controller monitors the state of several sensors to decide what action to take. Each second, the system reads data from sensors that can either be active or inactive. Based on the current state of all sensors, the controller must perform exactly one action, such as activating a warning, checking a specific zone, or declaring an intrusion. Write a C program that reads the sensor states as input and prints the corresponding system action. -- Conditions: 1. You must determine exactly one action for every possible combination of sensor states. 2. You are not allowed to use any conditional statements (if, else if, else, or the ternary operator?). 3. You are not allowed to use logical operators. 4. You must use a single switch statement to control the program's behaviour. 5. Loops may only be used for reading input, not for making decisions. 6. The program should handle all possible combinations of the sensors' active/inactive states and print the appropriate response each time. -- Example (for understanding): If all sensors are inactive, the system should remain idle. If some sensors are active, the system should issue warnings or alerts based on the situation. If all sensors are active, the system should declare a confirmed intrusion. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/temp/sudipto1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/temp/sudipto1.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [sudipto1.c] -#include <stdio.h> -int main() -{ - - // variables to hold the state of a sensor (0 or 1) - int doorSensorState, windowSensorState, motionSensorState, glassbreakSensorState; - - // variable to check the combined state of all four sensor - int combinedState = 0; - - // a invalid flag to check the input are valid or not - unsigned int invalidFlag; - - // printing the way to usage the program - printf("------ Home Security Controller ------\n"); - printf("Enter sensor states (1 for active, 0 for inactive).\n"); - printf("Format: [Door] [Window] [Motion] [Glass Break]\n"); - printf("Example: 0 1 1 0\n"); - printf("Enter states (or press Ctrl+D for MacOS or Linux / Ctrl+Z for Windows to exit): "); - - // doing the main calculation - // chacking the combined state and taking a decision - while (scanf("%d %d %d %d", &doorSensorState, &windowSensorState, &motionSensorState, &glassbreakSensorState) == 4) - { - // validating input - // The expression (variable & ~1) results in 0 only if 'variable' is 0 or 1. - // For any other positive number, it's non-zero. - // We combine all checks with a bitwise OR. If any sensor state is invalid, - // the flag will become non-zero. - invalidFlag = (doorSensorState & ~1) | (windowSensorState & ~1) | (motionSensorState & ~1) | (glassbreakSensorState & ~1); - - // Combine the four sensor states into a single integer using bitwise operations. - // This creates a unique number from 0 to 15 for each possible combination. - // Bit 0: Door Sensor - // Bit 1: Window Sensor - // Bit 2: Motion Sensor - // Bit 3: Glass Break Sensor - combinedState = (glassbreakSensorState << 3) | (motionSensorState << 2) | (windowSensorState << 1) | doorSensorState; - - // If the invalid_input_flag is non-zero, we add 16 to the state. - // This pushes it outside the 0-15 range and forces the 'default' case in the switch. - // We achieve this by multiplying the flag (which is > 0) by 16. - combinedState += invalidFlag * 16; - - // printing the given state - printf("\n\nState : [Door : %d, Window : %d, Motion : %d, Glass Break : %d]\nState Id : %d", - doorSensorState, windowSensorState, motionSensorState, glassbreakSensorState, combinedState); - printf("\nSystem Action : "); - - // taking decision based on combined state - // A single switch statement controls the program's behavior. - // It handles all 2^4 = 16 possible combinations of sensor states, - // ensuring exactly one action is taken for every scenario. - switch (combinedState) - { - case 0: // Binary: 0000 - printf("System Idle. All sensors inactive.\n"); - break; - case 1: // Binary: 0001 - printf("Check front door camera.\n"); - break; - case 2: // Binary: 0010 - printf("Check window sensors.\n"); - break; - case 3: // Binary: 0011 - printf("Warning: Perimeter breach suspected. Check doors and windows.\n"); - break; - case 4: // Binary: 0100 - printf("Check interior cameras for movement.\n"); - break; - case 5: // Binary: 0101 - printf("Warning: Potential entry and movement detected. Check front door and interior. Ask for patrol.\n"); - break; - case 6: // Binary: 0110 - printf("Warning: Potential entry and movement detected. Check windows and interior. Ask for patrol.\n"); - break; - case 7: // Binary: 0111 - printf("Alert: High probability of unauthorized entry. Ask for patrol.\n"); - break; - case 8: // Binary: 1000 - printf("Alert: Glass break detected. High-priority event. Ask for patrol.\n"); - break; - case 9: // Binary: 1001 - printf("Severe Alert: Forced entry likely (door + glass). Activate Alarm and Contact authorities.\n"); - break; - case 10: // Binary: 1010 - printf("Severe Alert: Forced entry likely (window + glass). Activate Alarm and Contact authorities.\n"); - break; - case 11: // Binary: 1011 - printf("Intrusion Alert: Multiple perimeter breaches. Activate Alarm and Contact authorities.\n"); - break; - case 12: // Binary: 1100 - printf("Intrusion Alert: Confirmed interior presence after breach. Activate Alarm and Contact authorities.\n"); - break; - case 13: // Binary: 1101 - printf("INTRUSION CONFIRMED! Activate maximum response protocol. Activate Alarm and Contact authorities.\n"); - break; - case 14: // Binary: 1110 - printf("INTRUSION CONFIRMED! Activate maximum response protocol. Activate Alarm and Contact authorities.\n"); - break; - case 15: // Binary: 1111 - printf("CATASTROPHIC EVENT! ALL SENSORS TRIGGERED. ACTIVATE ALARM AND CONTACT COPS.\n"); - break; - default: - // This case should not be reached with valid 0/1 input but is included for completeness. - printf("Error: Invalid sensor state detected.\n"); - break; - } - - // discarding extra characters (if any) left - while (getchar() != '\n') - ; - - // asking for next set of input - printf("\nEnter next set of states: "); - } - printf("\nSecurity system shutting down.\n"); -} -``` diff --git a/docs/semester_1/temp/sudiptoown01.md b/docs/semester_1/temp/sudiptoown01.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> sudiptoown01.c' -description: 'C program — sudiptoown01.c' -source: 'semester_1/temp/sudiptoown01.c' ---- - -# sudiptoown01.c - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/temp/sudiptoown01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/temp/sudiptoown01.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [sudiptoown01.c] -#include <stdio.h> - -int casekey(int door, int window, int motion, int glass) { - int key = (door << 3) | (window << 2) | (motion << 1) | glass; - return key; -} - -int main() { - int door, window, motion, glass, key; - char choice; - - static const char *action[16] = { - "IDLE", "CHECK WINDOW", "WARN MOTION", "WARN MOTION WINDOW", - "CHECK DOOR", "WARN DOOR WINDOW", "INTRUSION SUSPECTED", "INTRUSION CONFIRMED", - "GLASS ONLY", "DOOR GLASS", "MOTION GLASS", "MOTION WINDOW GLASS", - "DOOR WINDOW", "DOOR WINDOW GLASS", "DOOR MOTION GLASS", "ALL SENSORS" - }; - - do { - printf("Sensors: Door, Window, Motion, Glass\n"); - printf("Enter the state of each sensor in binary (0 or 1): "); - scanf("%d %d %d %d", &door, &window, &motion, &glass); - - key = casekey(door, window, motion, glass); - printf("Action: %s\n", action[key]); - - printf("Want to continue? (y/n): "); - scanf(" %c", &choice); - printf("\n"); - } while (choice == 'y' || choice == 'Y'); - - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-001.md b/docs/semester_1/tuition-c/APC-PRAC-001.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-001.c' -description: 'WAP to calculate area and perimeter of a rectangle by accepting length and breadth as input.' -source: 'semester_1/tuition-c/APC-PRAC-001.c' ---- - -# APC-PRAC-001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate area and perimeter of a rectangle by accepting length and breadth as input. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-001.c] -#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; - -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-002.md b/docs/semester_1/tuition-c/APC-PRAC-002.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-002.c' -description: 'WAP to calculate area of a circle using math library method. Take radius of the circle as input.' -source: 'semester_1/tuition-c/APC-PRAC-002.c' ---- - -# APC-PRAC-002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate area of a circle using math library method. Take radius of the circle as input. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-002.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-003.md b/docs/semester_1/tuition-c/APC-PRAC-003.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-003.c' -description: 'WAP to accept diagonal of a square and calculate area, parimeter' -source: 'semester_1/tuition-c/APC-PRAC-003.c' ---- - -# APC-PRAC-003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to accept diagonal of a square and calculate area, parimeter -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-003.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-004.md b/docs/semester_1/tuition-c/APC-PRAC-004.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-004.c' -description: 'WAP to calculate and display radius of a circle by taking the area as input.' -source: 'semester_1/tuition-c/APC-PRAC-004.c' ---- - -# APC-PRAC-004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate and display radius of a circle by taking the area as input. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-004.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-005.md b/docs/semester_1/tuition-c/APC-PRAC-005.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-005.c' -description: 'WAP a program that accept number of days as input and represent it as years, months and days.' -source: 'semester_1/tuition-c/APC-PRAC-005.c' ---- - -# APC-PRAC-005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP a program that accept number of days as input and represent it as years, months and days. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-005.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-006.md b/docs/semester_1/tuition-c/APC-PRAC-006.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-006.c' -description: 'WAP that accept seconds as input and represent it an hours, minutes and seconds.' -source: 'semester_1/tuition-c/APC-PRAC-006.c' ---- - -# APC-PRAC-006.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP that accept seconds as input and represent it an hours, minutes and seconds. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-006.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-007.md b/docs/semester_1/tuition-c/APC-PRAC-007.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-007.c' -description: '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' -source: 'semester_1/tuition-c/APC-PRAC-007.c' ---- - -# APC-PRAC-007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-007.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-008.md b/docs/semester_1/tuition-c/APC-PRAC-008.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-008.c' -description: 'WAP to multiply and divide a number by 4 without using multiplication and division operator.' -source: 'semester_1/tuition-c/APC-PRAC-008.c' ---- - -# APC-PRAC-008.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to multiply and divide a number by 4 without using multiplication and division operator. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-008.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-009.md b/docs/semester_1/tuition-c/APC-PRAC-009.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-009.c' -description: 'WAP to swap two integer variable without using Third variable.' -source: 'semester_1/tuition-c/APC-PRAC-009.c' ---- - -# APC-PRAC-009.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to swap two integer variable without using Third variable. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-009.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-010.md b/docs/semester_1/tuition-c/APC-PRAC-010.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-010.c' -description: '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.' -source: 'semester_1/tuition-c/APC-PRAC-010.c' ---- - -# APC-PRAC-010.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-010.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-011.md b/docs/semester_1/tuition-c/APC-PRAC-011.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-011.c' -description: 'Write a program to input positive number and check whether the number is perfect square or not. If the number is negetive then display appropriate message' -source: 'semester_1/tuition-c/APC-PRAC-011.c' ---- - -# APC-PRAC-011.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to input positive number and check whether the number is perfect square or not. If the number is negetive then display appropriate message -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-011.c] -#include <stdio.h> -#include <math.h> - -int main() -{ - int num, temp; - printf("Enter the number : "); - scanf("%d", &num); - if (num < 0) - { - printf("\nYou entered a negetive number."); - return 1; - } - temp = (int)sqrt(num); - if (temp * temp == num) - { - printf("\nInput %d is a perfect square number.", num); - return 0; - } - else - printf("\nInput %d is not a perfect square number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-012.md b/docs/semester_1/tuition-c/APC-PRAC-012.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-012.c' -description: 'Write a program to input three integer and find out second largest' -source: 'semester_1/tuition-c/APC-PRAC-012.c' ---- - -# APC-PRAC-012.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to input three integer and find out second largest -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-012.c] -#include <stdio.h> - -int main() -{ - int a, b, c, secondLargest; - printf("Enter three number : "); - scanf("%d %d %d", &a, &b, &c); - if ((a < b && a > c) || (a > b && a < c)) - secondLargest = a; - if ((b < a && b > c) || (b > a && b < c)) - secondLargest = b; - if ((c < b && c > a) || (c > b && c < a)) - secondLargest = c; - printf("\nSecond Largest : %d", secondLargest); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-013.md b/docs/semester_1/tuition-c/APC-PRAC-013.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-013.c' -description: 'Write a program to input sum(p), rate of interest(r), time(t) and type of interest (''s'' for simple interes, ''c'' for compound interest), then calculate and display the earned interest' -source: 'semester_1/tuition-c/APC-PRAC-013.c' ---- - -# APC-PRAC-013.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to input sum(p), rate of interest(r), time(t) and type of interest ('s' for simple interes, 'c' for compound interest), then calculate and display the earned interest -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-013.c] -#include <stdio.h> -#include <math.h> -#include <ctype.h> - -int main() -{ - double p, t, r, si, ci; - char mode; - printf("Enter the Principle, Time (Year) and the Rate of Interest : "); - scanf("%lf %lf %lf", &p, &t, &r); - printf("Enter the mode of calculation ('s' for simple interest, 'c' for compound interest) : "); - scanf(" %c", &mode); - mode = tolower(mode); - switch (mode) - { - case 's': - si = (p * t * r) / 100; - printf("\nSimple Interest : %g", si); - return 0; - case 'c': - ci = (p * pow(1 + (r / 100), t)) - p; - printf("\nCompound Interest : %g", ci); - return 0; - default: - printf("\nYou entered a wrong choice."); - return 1; - } -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-014.md b/docs/semester_1/tuition-c/APC-PRAC-014.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-014.c' -description: 'Write a program to calculate and display the maturity amount taking the sum and number of days as input. No. of Days Rate of Interest =========== ================ <= 180 5.57 % 181 - 364 7.75 % 365 - 500 9.25 % > 500 9.15 %' -source: 'semester_1/tuition-c/APC-PRAC-014.c' ---- - -# APC-PRAC-014.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate and display the maturity amount taking the sum and number of days as input. No. of Days Rate of Interest =========== ================ <= 180 5.57 % 181 - 364 7.75 % 365 - 500 9.25 % > 500 9.15 % -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-014.c] -#include <stdio.h> - -int main() -{ - double p, t, r, si; - int days; - printf("Enter the Principle, Time (Days) : "); - scanf("%lf %d", &p, &days); - if (days > 0 && days <= 180) - r = 5.57; - else if (days > 180 && days <= 364) - r = 7.75; - else if (days > 364 && days <= 500) - r = 9.25; - else if (days > 500) - r = 9.15; - si = (p * t * r) / 100; - printf("\nMaturity Amount : %d", si + p); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-015.md b/docs/semester_1/tuition-c/APC-PRAC-015.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-015.c' -description: 'Write a program to display all numbers between lb (lower bound) and up (upper bound) which ends with digit 7 or divisible by 7.' -source: 'semester_1/tuition-c/APC-PRAC-015.c' ---- - -# APC-PRAC-015.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to display all numbers between lb (lower bound) and up (upper bound) which ends with digit 7 or divisible by 7. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-015.c] -#include <stdio.h> - -int main() -{ - int lb, ub, i; - printf("Enter the lb, ub : "); - scanf("%d %d", &lb, &ub); - printf("\nEnds with 7 :"); - for (i = lb; i <= ub; i++) - { - if (i % 10 == 7) - { - printf(" %d", i); - } - } - printf("\nDivisible by 7 :"); - for (i = lb; i <= ub; i++) - { - if (i % 7 == 0) - { - printf(" %d", i); - } - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-016.md b/docs/semester_1/tuition-c/APC-PRAC-016.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-016.c' -description: 'Write a program to check palindrome number.' -source: 'semester_1/tuition-c/APC-PRAC-016.c' ---- - -# APC-PRAC-016.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check palindrome number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-016.c] -#include <stdio.h> - -int main() -{ - int num, temp, rev = 0; - printf("Enter the number : "); - scanf("%d", &num); - temp = num; - while (temp > 0) - { - rev = (rev * 10) + (temp % 10); - temp /= 10; - } - if (rev == num) - printf("\nInput %d is a palindrome number.", num); - else - printf("\nInput %d is not a palindrome number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-017.md b/docs/semester_1/tuition-c/APC-PRAC-017.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-017.c' -description: 'Write a program to check perfect number.' -source: 'semester_1/tuition-c/APC-PRAC-017.c' ---- - -# APC-PRAC-017.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check perfect number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-017.c] -#include <stdio.h> - -int main() -{ - int num, i, divisibleSum = 0; - printf("Enter a number : "); - scanf("%d", &num); - for (i = 1; i <= num / 2; i++) - { - if (num % i == 0) - { - divisibleSum += i; - } - } - if (divisibleSum == num) - printf("\nInput %d ia a Perfect Number.", num); - else - printf("\nInput %d is NOT a Perfect Number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-018.md b/docs/semester_1/tuition-c/APC-PRAC-018.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-018.c' -description: 'Write a program to check Automorphic Number.' -source: 'semester_1/tuition-c/APC-PRAC-018.c' ---- - -# APC-PRAC-018.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check Automorphic Number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-018.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-018.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-018.c] -#include <stdio.h> -#include <math.h> - -int main() -{ - int num, square, count = 0, temp, modNum; - printf("Enter the number : "); - scanf("%d", &num); - square = (int)pow(num, 2); - temp = num; - while (temp > 0) - { - temp /= 10; - count++; - } - modNum = (int)pow(10, count); - temp = square % modNum; - if (num == temp) - printf("\nInput %d is a Automorphic Number.", num); - else - printf("\nInput %d is a Automorphic Number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-019.md b/docs/semester_1/tuition-c/APC-PRAC-019.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-019.c' -description: 'Write a program to find hcf of two numbers' -source: 'semester_1/tuition-c/APC-PRAC-019.c' ---- - -# APC-PRAC-019.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find hcf of two numbers -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-019.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-019.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-019.c] -#include <stdio.h> - -int main() -{ - int a, b, temp, temp_a, temp_b; - printf("Enter the a and b : "); - scanf("%d %d", &a, &b); - temp_a = a, temp_b = b; - while (b > 0) - { - temp = a; - a = b; - b = temp % b; - } - printf("\nHCF of %d and %d is : %d\n", temp_a, temp_b, a); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-020.md b/docs/semester_1/tuition-c/APC-PRAC-020.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-020.c' -description: 'Write a program to check if two number is co-prime or not' -source: 'semester_1/tuition-c/APC-PRAC-020.c' ---- - -# APC-PRAC-020.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check if two number is co-prime or not -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-020.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-020.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-020.c] -#include <stdio.h> - -int main() -{ - int a, b, temp, temp_a, temp_b; - printf("Enter the a and b : "); - 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 and %d is co-prime\n", temp_a, temp_b); - else - printf("\n%d and %d is NOT co-prime\n", temp_a, temp_b); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-021.md b/docs/semester_1/tuition-c/APC-PRAC-021.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-021.c' -description: 'Write a program to check special number (sum of digit + product of digit = original number)' -source: 'semester_1/tuition-c/APC-PRAC-021.c' ---- - -# APC-PRAC-021.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check special number (sum of digit + product of digit = original number) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-021.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-021.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-021.c] -#include <stdio.h> - -int main() -{ - int num, temp, sumOfDigit = 0, productOfDigit = 1; - printf("Enter the number to check if it is a special number : "); - scanf("%d", &num); - temp = num; - while (temp > 0) - { - sumOfDigit += temp % 10; - productOfDigit *= temp % 10; - temp /= 10; - } - temp = sumOfDigit + productOfDigit; - if (num == temp) - printf("\nInput %d is a special number.", num); - else - printf("\nInput %d is not a special number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-022.md b/docs/semester_1/tuition-c/APC-PRAC-022.md @@ -1,91 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-022.c' -description: 'Write a program to accept a number and check whether the number is twisted prime or not' -source: 'semester_1/tuition-c/APC-PRAC-022.c' ---- - -# APC-PRAC-022.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to accept a number and check whether the number is twisted prime or not -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-022.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-022.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-022.c] -#include <stdio.h> -#include <math.h> -#include <stdbool.h> - -bool checkPrime(int num) -{ - if (num < 2) - return false; - if (num == 2) - return true; - if (num % 2 == 0) - return false; - int limit = (int)sqrt(num); - for (int i = 3; i <= limit; i += 2) - if (num % i == 0) - return false; - return true; -} - -int reverseNumber(int num) -{ - int reverse = 0; - while (num > 0) - { - reverse = (reverse * 10) + (num % 10); - num /= 10; - } - return reverse; -} - -int main() -{ - int num; - printf("Enter the number : "); - scanf("%d", &num); - if (!checkPrime(num)) - { - printf("\nInput %d is not a prime number.", num); - return 0; - } - if (checkPrime(reverseNumber(num))) - printf("\nInput %d is a twisted prime number.", num); - else - printf("\nInput %d is not a twisted prime number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-023.md b/docs/semester_1/tuition-c/APC-PRAC-023.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-023.c' -description: 'Pattern : (a) 1, -3, 5, -7, 9, -11, ... upto n times (b) 0, 3, 8, 15, ... upto n times' -source: 'semester_1/tuition-c/APC-PRAC-023.c' ---- - -# APC-PRAC-023.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern : (a) 1, -3, 5, -7, 9, -11, ... upto n times (b) 0, 3, 8, 15, ... upto n times -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-023.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-023.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-023.c] -#include <stdio.h> -#include <stdbool.h> - -int main() -{ - int n, i, temp = 1; - bool isNegative = true; - printf("Enter the n : "); - scanf("%d", &n); - printf("\nPattern A :"); - for (i = 1; i <= n; i++) - { - if (!isNegative) - { - printf(" %d", temp * -1); - isNegative = true; - } - else - { - printf(" %d", temp); - isNegative = false; - } - temp += 2; - } - printf("\nPattern B :"); - for (i = 1; i <= n; i++) - { - temp = (i * i) - 1; - printf(" %d", temp); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-024.md b/docs/semester_1/tuition-c/APC-PRAC-024.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-024.c' -description: 'Pattern: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1' -source: 'semester_1/tuition-c/APC-PRAC-024.c' ---- - -# APC-PRAC-024.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-024.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-024.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-024.c] -#include<stdio.h> -int main() { - int n, i, j; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = i; j >= 1; j--) { - printf("%d ", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-025.md b/docs/semester_1/tuition-c/APC-PRAC-025.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-025.c' -description: 'Pattern: 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5' -source: 'semester_1/tuition-c/APC-PRAC-025.c' ---- - -# APC-PRAC-025.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-025.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-025.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-025.c] -#include<stdio.h> -int main() { - int n, i, j; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = n; j >= i; j--) { - printf("%d ", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-026.md b/docs/semester_1/tuition-c/APC-PRAC-026.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-026.c' -description: 'Pattern: 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1' -source: 'semester_1/tuition-c/APC-PRAC-026.c' ---- - -# APC-PRAC-026.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-026.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-026.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-026.c] -#include<stdio.h> -int main() { - int n, i, j; - printf("Enter the n : "); - scanf("%d", &n); - for(i = n; i >= 1; i--) { - for(j = n; j >= i; j--) { - printf("%d ", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-027.md b/docs/semester_1/tuition-c/APC-PRAC-027.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-027.c' -description: 'Pattern: 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5' -source: 'semester_1/tuition-c/APC-PRAC-027.c' ---- - -# APC-PRAC-027.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-027.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-027.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-027.c] -#include<stdio.h> -int main() { - int n, i, j; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = i; j <= n; j++) { - printf("%d ", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-028.md b/docs/semester_1/tuition-c/APC-PRAC-028.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-028.c' -description: 'Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15' -source: 'semester_1/tuition-c/APC-PRAC-028.c' ---- - -# APC-PRAC-028.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-028.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-028.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-028.c] -#include<stdio.h> -int main() { - int n, i, j, temp = 1; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = 1; j <= i; j++) { - printf("%d\t", temp); - temp++; - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-029.md b/docs/semester_1/tuition-c/APC-PRAC-029.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-029.c' -description: 'Pattern: 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1' -source: 'semester_1/tuition-c/APC-PRAC-029.c' ---- - -# APC-PRAC-029.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-029.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-029.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-029.c] -#include<stdio.h> -int main() { - int n, i, j; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = 1; j <= i; j++) { - if(j % 2 == 0) printf("0 "); - else printf("1 "); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-030.md b/docs/semester_1/tuition-c/APC-PRAC-030.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-030.c' -description: 'Pattern: # @ @ # # # @ @ @ @ # # # # #' -source: 'semester_1/tuition-c/APC-PRAC-030.c' ---- - -# APC-PRAC-030.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: # @ @ # # # @ @ @ @ # # # # # -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-030.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-030.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-030.c] -#include<stdio.h> -int main() { - int n, i, j; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = 1; j <= i; j++) { - if(i % 2 == 0) printf("@ "); - else printf("# "); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-031.md b/docs/semester_1/tuition-c/APC-PRAC-031.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-031.c' -description: 'Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15' -source: 'semester_1/tuition-c/APC-PRAC-031.c' ---- - -# APC-PRAC-031.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-031.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-031.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-031.c] -#include<stdio.h> -int main() { - int n, i, j, temp = 1; - printf("Enter the n : "); - scanf("%d", &n); - for(i = n; i >= 1; i--) { - for(j = 1; j <= i; j++) { - printf("%d\t", temp); - temp++; - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-032.md b/docs/semester_1/tuition-c/APC-PRAC-032.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-032.c' -description: 'Pattern: A B B C C C D D D D E E E E E' -source: 'semester_1/tuition-c/APC-PRAC-032.c' ---- - -# APC-PRAC-032.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Pattern: A B B C C C D D D D E E E E E -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-032.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-032.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-032.c] -#include<stdio.h> -int main() { - int n, i, j; char temp = 'A'; - printf("Enter the n : "); - scanf("%d", &n); - for(i = 1; i <= n; i++) { - for(j = 1; j <= i; j++) { - printf("%c\t", temp); - } - temp++; - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-033.md b/docs/semester_1/tuition-c/APC-PRAC-033.md @@ -1,75 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-033.c' -description: 'Print the factorial of the digits off a number' -source: 'semester_1/tuition-c/APC-PRAC-033.c' ---- - -# APC-PRAC-033.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Print the factorial of the digits off a number -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-033.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-033.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-033.c] -#include <stdio.h> - -int factorial(int); - -int factorial(int n) -{ - int i, fact = 1; - for (i = 1; i <= n; i++) - fact *= i; - return fact; -} - -int main() -{ - int n, temp; - printf("Enter the number: "); - scanf("%d", &n); - if (n < 0) - { - printf("Only non-negetive number is allowed."); - return 1; - } - temp = n; - while (temp > 0) - { - printf("\nFactorial of %d: %d", temp % 10, factorial(temp % 10)); - temp /= 10; - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-034.md b/docs/semester_1/tuition-c/APC-PRAC-034.md @@ -1,76 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-034.c' -description: 'Take a Range as input from user and print the prime number between it.' -source: 'semester_1/tuition-c/APC-PRAC-034.c' ---- - -# APC-PRAC-034.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Take a Range as input from user and print the prime number between it. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-034.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-034.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-034.c] -#include <stdio.h> -#include <math.h> - -int isPrime(int); - -int isPrime(int n) -{ - if (n <= 1) - return 0; - if (n == 2) - return 1; - if (n % 2 == 0) - return 0; - int temp = (int)sqrt(n), i; - for (i = 3; i <= temp; i += 2) - if (n % i == 0) - return 0; - return 1; -} - -int main() -{ - int lb, ub, i; - printf("Enter the lower bound and the upper bound: "); - scanf("%d %d", &lb, &ub); - printf("\nPrime numbers between %d and %d: ", lb, ub); - for (i = lb; i <= ub; i++) - if (isPrime(i)) - printf("%d ", i); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-035.md b/docs/semester_1/tuition-c/APC-PRAC-035.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-035.c' -description: 'Print all the 3 and 4 digit palindrome number.' -source: 'semester_1/tuition-c/APC-PRAC-035.c' ---- - -# APC-PRAC-035.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Print all the 3 and 4 digit palindrome number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-035.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-035.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-035.c] -#include <stdio.h> - -int palindromeCheck(int); - -int palindromeCheck(int n) -{ - int temp = n, rev = 0; - while (temp > 0) - { - rev = (rev * 10) + (temp % 10); - temp /= 10; - } - if (rev == n) - return 1; - else - return 0; -} - -int main() -{ - int i; - printf("Palindrome number of 3 and 4 digits: "); - for (i = 100; i <= 9999; i++) - if (palindromeCheck(i)) - printf("%d ", i); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-036.md b/docs/semester_1/tuition-c/APC-PRAC-036.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-036.c' -description: 'Check krishnamurty number.' -source: 'semester_1/tuition-c/APC-PRAC-036.c' ---- - -# APC-PRAC-036.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Check krishnamurty number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-036.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-036.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-036.c] -#include <stdio.h> - -int factorial(int); -int checkKrishnamurty(int); - -int factorial(int n) -{ - int i, fact = 1; - for (i = 1; i <= n; i++) - fact *= i; - return fact; -} - -int checkKrishnamurty(int n) -{ - int temp1 = n, temp2 = 0; - while (temp1 > 0) - { - temp2 += factorial(temp1 % 10); - temp1 /= 10; - } - if (temp2 == n) - return 1; - else - return 0; -} - -int main() -{ - int n; - printf("Enter the number: "); - scanf("%d", &n); - if (checkKrishnamurty(n)) - printf("\nInput %d is a Krishnamurty number.", n); - else - printf("\ninput %d is not a Krishnamurty number.", n); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-037.md b/docs/semester_1/tuition-c/APC-PRAC-037.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-037.c' -description: 'Show all the armstrong number between a range.' -source: 'semester_1/tuition-c/APC-PRAC-037.c' ---- - -# APC-PRAC-037.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Show all the armstrong number between a range. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-037.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-037.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-037.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-038.md b/docs/semester_1/tuition-c/APC-PRAC-038.md @@ -1,67 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-038.c' -description: '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.' -source: 'semester_1/tuition-c/APC-PRAC-038.c' ---- - -# APC-PRAC-038.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-038.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-038.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-038.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-039.md b/docs/semester_1/tuition-c/APC-PRAC-039.md @@ -1,70 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-039.c' -description: '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)' -source: 'semester_1/tuition-c/APC-PRAC-039.c' ---- - -# APC-PRAC-039.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-039.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-039.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-039.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-040.md b/docs/semester_1/tuition-c/APC-PRAC-040.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-040.c' -description: 'Write a C program to count how many numbers between 100 and 999 have all distinct digits (e.g., 123, 709, 981).' -source: 'semester_1/tuition-c/APC-PRAC-040.c' ---- - -# APC-PRAC-040.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to count how many numbers between 100 and 999 have all distinct digits (e.g., 123, 709, 981). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-040.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-040.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-040.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-041.md b/docs/semester_1/tuition-c/APC-PRAC-041.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-041.c' -description: '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)' -source: 'semester_1/tuition-c/APC-PRAC-041.c' ---- - -# APC-PRAC-041.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-041.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-041.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-041.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-PRAC-042.md b/docs/semester_1/tuition-c/APC-PRAC-042.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-PRAC-042.c' -description: 'Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome.' -source: 'semester_1/tuition-c/APC-PRAC-042.c' ---- - -# APC-PRAC-042.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a function to check whether a given string is a palindrome. Use this function to determine whether an entered string is Palindrome. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-PRAC-042.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-PRAC-042.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-PRAC-042.c] -#include <stdio.h> -#include <string.h> - -int isPalindrome(char[]); - -int main() -{ - char input[100]; - int len; - - printf("Enter the string (Max: 100 Character): "); - fgets(input, sizeof(input), stdin); - len = strlen(input); - - if (len > 0 && input[len - 1] == '\n') - { - input[len - 1] = '\0'; - } - - if (isPalindrome(input)) - { - printf("\nInput string \"%s\" is Palindrome.", input); - } - else - { - printf("\nInput string \"%s\" is not Palindrome", input); - } - - return 0; -} - -int isPalindrome(char str[]) -{ - char *start = str; - char *end; - int len = strlen(str); - - if (len == 0) - { - return 1; - } - - end = str + (len - 1); - - while (start < end) - { - if (*start != *end) - { - return 0; - } - start++; - end--; - } - - return 1; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-001.md b/docs/semester_1/tuition-c/APC-S-001.md @@ -1,49 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-001.c' -description: 'C program — APC-S-001.c' -source: 'semester_1/tuition-c/APC-S-001.c' ---- - -# APC-S-001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-001.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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-002.md b/docs/semester_1/tuition-c/APC-S-002.md @@ -1,46 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-002.c' -description: 'C program — APC-S-002.c' -source: 'semester_1/tuition-c/APC-S-002.c' ---- - -# APC-S-002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-002.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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-003.md b/docs/semester_1/tuition-c/APC-S-003.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-003.c' -description: 'C program — APC-S-003.c' -source: 'semester_1/tuition-c/APC-S-003.c' ---- - -# APC-S-003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-003.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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-004.md b/docs/semester_1/tuition-c/APC-S-004.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-004.c' -description: 'Program to print first 10 natural numbers using while loop.' -source: 'semester_1/tuition-c/APC-S-004.c' ---- - -# APC-S-004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Program to print first 10 natural numbers using while loop. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-004.c] -#include <stdio.h> -#include <conio.h> - -void main() -{ - clrscr(); - int x; - x = 1; - while (x <= 10) - { - printf("%d ", x); - x++; - } - getch(); -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-005.md b/docs/semester_1/tuition-c/APC-S-005.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-005.c' -description: 'Write to reverse a number.' -source: 'semester_1/tuition-c/APC-S-005.c' ---- - -# APC-S-005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write to reverse a number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-005.c] -#include <stdio.h> -#include <conio.h> - -void main() -{ - clrscr(); - int n, reverse = 0, rem; - printf("Enter the numner : "); - scanf("%d", &n); - while (n != 0) - { - rem = n % 10; - reverse = reverse * 10 + rem; - n /= 10; - } - printf("Reversed Number : %d", reverse); - getch(); -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-006.md b/docs/semester_1/tuition-c/APC-S-006.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-006.c' -description: 'Write a program to print first 10 multiple of 5' -source: 'semester_1/tuition-c/APC-S-006.c' ---- - -# APC-S-006.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to print first 10 multiple of 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-006.c] -#include <stdio.h> -#include <conio.h> - -void main() -{ - clrscr(); - int a = 5, i = 1, res; - while (i <= 10) - { - res = a * i; - printf("%d * %d = %d\n", a, i, res); - i++; - } - getch(); -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-007.md b/docs/semester_1/tuition-c/APC-S-007.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-007.c' -description: 'Write a program the sum of first 10 natural numbers.' -source: 'semester_1/tuition-c/APC-S-007.c' ---- - -# APC-S-007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program the sum of first 10 natural numbers. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-007.c] -#include <stdio.h> -#include <conio.h> - -void main() -{ - clrscr(); - int i, sum = 0; - for (i = 1; i <= 10; i++) - { - sum += i; - } - printf("\nSum of the first natural number : %d", sum); - getch(); -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-008.md b/docs/semester_1/tuition-c/APC-S-008.md @@ -1,99 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-008.c' -description: 'Write a program to print the sum of two matrix as input given by the user.' -source: 'semester_1/tuition-c/APC-S-008.c' ---- - -# APC-S-008.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to print the sum of two matrix as input given by the user. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-008.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-009.md b/docs/semester_1/tuition-c/APC-S-009.md @@ -1,104 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-009.c' -description: 'Write a program to find the upper and lower triangular matrix.' -source: 'semester_1/tuition-c/APC-S-009.c' ---- - -# APC-S-009.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the upper and lower triangular matrix. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-009.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-010.md b/docs/semester_1/tuition-c/APC-S-010.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-010.c' -description: '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' -source: 'semester_1/tuition-c/APC-S-010.c' ---- - -# APC-S-010.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-010.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-011.md b/docs/semester_1/tuition-c/APC-S-011.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-011.c' -description: 'Linear search' -source: 'semester_1/tuition-c/APC-S-011.c' ---- - -# APC-S-011.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Linear search -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-011.c] -#include <stdio.h> - -int main() -{ - int elementCount, i, keyElement; - - printf("Enter the number of element you want to add: "); - scanf("%d", &elementCount); - - int elements[elementCount]; - - for (i = 0; i < elementCount; i++) - { - printf("Enter Element %d: ", i + 1); - scanf("%d", &elements[i]); - } - - printf("\nEnter the Key Element you want to search: "); - scanf("%d", &keyElement); - for (i = 0; i < elementCount; i++) - if (elements[i] == keyElement) - { - printf("\nKey Element %d is found in %d position.", keyElement, i); - return 0; - } - printf("\nKey Element %d is not found.", keyElement); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-012.md b/docs/semester_1/tuition-c/APC-S-012.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-012.c' -description: 'Write a program to check if a matrix is a sparx matrix.' -source: 'semester_1/tuition-c/APC-S-012.c' ---- - -# APC-S-012.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check if a matrix is a sparx matrix. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-012.c] -#include <stdio.h> - -int main() -{ - int i, j, row, col, count = 0; - - printf("Enter the number of rows and columns in the matrix: "); - scanf("%d %d", &row, &col); - - int matrix[row][col]; - - for (i = 0; i < row; i++) - for (j = 0; j < col; j++) - { - printf("Postion %d%d: ", i, j); - scanf("%d", &matrix[i][j]); - if (matrix[i][j] == 0) - count++; - } - - printf("\nEntered Matrix: \n"); - for (i = 0; i < row; i++) - { - for (j = 0; j < col; j++) - printf("%d ", matrix[i][j]); - printf("\n"); - } - - if (count > (row * col) / 2) - printf("\nEntered matrix is a Sparx Matrix."); - else - printf("\nEntered matrix is not a Sparx Matrix"); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-013.md b/docs/semester_1/tuition-c/APC-S-013.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-013.c' -description: 'Write a fuction to calculate the average of an array' -source: 'semester_1/tuition-c/APC-S-013.c' ---- - -# APC-S-013.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a fuction to calculate the average of an array -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-013.c] -#include <stdio.h> - -double average(int []); - -int main() -{ - int marks[10], i; - printf("\nEnter 10 numbers: \n"); - for (i = 0; i <= 9; i++) - { - printf("Enter number %d: ", i + 1); - scanf("%d", &marks[i]); - } - printf("\nAverage = %g", average(marks)); - return 0; -} - -double average(int marks[10]) -{ - int sum = 0; - for (int i = 0; i <= 9; i++) - sum += marks[i]; - return sum / 10.0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-S-014.md b/docs/semester_1/tuition-c/APC-S-014.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-S-014.c' -description: 'Write a program to store roll no, name and marks of 5 students then print it. use structure' -source: 'semester_1/tuition-c/APC-S-014.c' ---- - -# APC-S-014.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 14 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to store roll no, name and marks of 5 students then print it. use structure -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-S-014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-S-014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-S-014.c] -#include <stdio.h> -#include <string.h> - -struct student -{ - int roll_no; - char name[30]; - float marks; -}; - -int main() -{ - int i, stu_count = 3; - struct student s[stu_count]; - for (i = 0; i < stu_count; i++) - { - printf("\nEnter the Roll Number: "); - scanf("%d", &s[i].roll_no); - getchar(); - printf("Enter the name: "); - gets(s[i].name); - printf("Enter the Marks: "); - scanf("%f", &s[i].marks); - } - printf("\n%-10s %-20s %-10s\n", "ROLL", "NAME", "MARKS"); - printf("%-10s %-20s %-10s\n", "====", "====", "====="); - for (i = 0; i < stu_count; i++) - { - printf("%-10d %-20s %-10.2f\n", s[i].roll_no, s[i].name, s[i].marks); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-001.md b/docs/semester_1/tuition-c/APC-SPS-001.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-001.c' -description: 'C program — APC-SPS-001.c' -source: 'semester_1/tuition-c/APC-SPS-001.c' ---- - -# APC-SPS-001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-001.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-002.md b/docs/semester_1/tuition-c/APC-SPS-002.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-002.c' -description: 'WAP to swap two integers. Display both numbers before and after swap' -source: 'semester_1/tuition-c/APC-SPS-002.c' ---- - -# APC-SPS-002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to swap two integers. Display both numbers before and after swap -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-002.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-003.md b/docs/semester_1/tuition-c/APC-SPS-003.md @@ -1,54 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-003.c' -description: 'Bitwise AND ''&''' -source: 'semester_1/tuition-c/APC-SPS-003.c' ---- - -# APC-SPS-003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Bitwise AND '&' -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-003.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-004.md b/docs/semester_1/tuition-c/APC-SPS-004.md @@ -1,46 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-004.c' -description: 'C program — APC-SPS-004.c' -source: 'semester_1/tuition-c/APC-SPS-004.c' ---- - -# APC-SPS-004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-004.c] -#include<stdio.h> -int main() { - int x = 25, y = 19, z; - z = x - y; - z = z & x ; - printf("Z = %d", z); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-005.md b/docs/semester_1/tuition-c/APC-SPS-005.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-005.c' -description: 'Bitwise OR ''|''' -source: 'semester_1/tuition-c/APC-SPS-005.c' ---- - -# APC-SPS-005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Bitwise OR '|' -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-005.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-006.md b/docs/semester_1/tuition-c/APC-SPS-006.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-006.c' -description: 'Bitwise NOT ''~''' -source: 'semester_1/tuition-c/APC-SPS-006.c' ---- - -# APC-SPS-006.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Bitwise NOT '~' -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-006.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-007.md b/docs/semester_1/tuition-c/APC-SPS-007.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-007.c' -description: 'WAP to check a number is even or odd using bitwise operator' -source: 'semester_1/tuition-c/APC-SPS-007.c' ---- - -# APC-SPS-007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to check a number is even or odd using bitwise operator -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-007.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/APC-SPS-008.md b/docs/semester_1/tuition-c/APC-SPS-008.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> APC-SPS-008.c' -description: 'WAP to calculate area of circle by accepting radius as input' -source: 'semester_1/tuition-c/APC-SPS-008.c' ---- - -# APC-SPS-008.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate area of circle by accepting radius as input -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/APC-SPS-008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/APC-SPS-008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [APC-SPS-008.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P001.md b/docs/semester_1/tuition-c/P001.md @@ -1,43 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P001.c' -description: 'C program — P001.c' -source: 'semester_1/tuition-c/P001.c' ---- - -# P001.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P001.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P001.c] -#include<stdio.h> -int main() { - printf("Hello world"); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P002.md b/docs/semester_1/tuition-c/P002.md @@ -1,43 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P002.c' -description: 'C program — P002.c' -source: 'semester_1/tuition-c/P002.c' ---- - -# P002.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P002.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P002.c] -#include<stdio.h> -int main() { - printf("Hello\nworld"); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P003.md b/docs/semester_1/tuition-c/P003.md @@ -1,51 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P003.c' -description: 'C program — P003.c' -source: 'semester_1/tuition-c/P003.c' ---- - -# P003.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P003.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P003.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P004.md b/docs/semester_1/tuition-c/P004.md @@ -1,52 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P004.c' -description: 'WAP to find and display the value of given expression : ((x+3)/4) - ((2x+4)/3) taking the value of x = 5' -source: 'semester_1/tuition-c/P004.c' ---- - -# P004.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to find and display the value of given expression : ((x+3)/4) - ((2x+4)/3) taking the value of x = 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P004.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P004.c] -#include<stdio.h> -int main() { - double x =5, result; - result = ((x + 3) / 4) - ((2 * x + 4) / 3); - printf("Result = %lf",result); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P005.md b/docs/semester_1/tuition-c/P005.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P005.c' -description: '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.' -source: 'semester_1/tuition-c/P005.c' ---- - -# P005.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P005.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P005.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P006.md b/docs/semester_1/tuition-c/P006.md @@ -1,52 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P006.c' -description: 'The normal temperature of human body is 98.6 Degree Fahrenheit. WAP to convert the temperature to Degree Celcius and display the output.' -source: 'semester_1/tuition-c/P006.c' ---- - -# P006.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -The normal temperature of human body is 98.6 Degree Fahrenheit. WAP to convert the temperature to Degree Celcius and display the output. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P006.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P006.c] -#include<stdio.h> -int main() { - double f = 98.6, c; - c = ((f - 32) * 5) / 9; - printf("Temperature in Celcius is : %lf",c); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P007.md b/docs/semester_1/tuition-c/P007.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P007.c' -description: '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.' -source: 'semester_1/tuition-c/P007.c' ---- - -# P007.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P007.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P007.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P008.md b/docs/semester_1/tuition-c/P008.md @@ -1,57 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P008.c' -description: '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.' -source: 'semester_1/tuition-c/P008.c' ---- - -# P008.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P008.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P008.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P009.md b/docs/semester_1/tuition-c/P009.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P009.c' -description: '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' -source: 'semester_1/tuition-c/P009.c' ---- - -# P009.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P009.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P009.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P010.md b/docs/semester_1/tuition-c/P010.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P010.c' -description: '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' -source: 'semester_1/tuition-c/P010.c' ---- - -# P010.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P010.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P010.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P011.md b/docs/semester_1/tuition-c/P011.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P011.c' -description: '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' -source: 'semester_1/tuition-c/P011.c' ---- - -# P011.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P011.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P011.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P012.md b/docs/semester_1/tuition-c/P012.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P012.c' -description: 'WAP to swap two integer variable without using third variable' -source: 'semester_1/tuition-c/P012.c' ---- - -# P012.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to swap two integer variable without using third variable -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P012.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P012.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P013.md b/docs/semester_1/tuition-c/P013.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P013.c' -description: 'WAP to swap two integer variable without using third variable' -source: 'semester_1/tuition-c/P013.c' ---- - -# P013.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to swap two integer variable without using third variable -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P013.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P013.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P014.md b/docs/semester_1/tuition-c/P014.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P014.c' -description: 'WAP to accept the diagonal of square. Find and display the area and perimeter of the square.' -source: 'semester_1/tuition-c/P014.c' ---- - -# P014.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to accept the diagonal of square. Find and display the area and perimeter of the square. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P014.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P014.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P015.md b/docs/semester_1/tuition-c/P015.md @@ -1,58 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P015.c' -description: 'WAP to accept number of days and display it after converting into number of years, months and days' -source: 'semester_1/tuition-c/P015.c' ---- - -# P015.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to accept number of days and display it after converting into number of years, months and days -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P015.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P015.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P016.md b/docs/semester_1/tuition-c/P016.md @@ -1,55 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P016.c' -description: 'WAP to calculate and display radius of a circle by taking the area as input' -source: 'semester_1/tuition-c/P016.c' ---- - -# P016.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate and display radius of a circle by taking the area as input -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P016.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P016.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P017.md b/docs/semester_1/tuition-c/P017.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P017.c' -description: 'Find maximum between three number.' -source: 'semester_1/tuition-c/P017.c' ---- - -# P017.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Find maximum between three number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P017.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P017.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P018.md b/docs/semester_1/tuition-c/P018.md @@ -1,67 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P018.c' -description: 'WAP to input the cost price and selling price and calculate profit, profit percentage, loss percentage or display the manage nither profit nor loss.' -source: 'semester_1/tuition-c/P018.c' ---- - -# P018.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to input the cost price and selling price and calculate profit, profit percentage, loss percentage or display the manage nither profit nor loss. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P018.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P018.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P018.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P019.md b/docs/semester_1/tuition-c/P019.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P019.c' -description: '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' -source: 'semester_1/tuition-c/P019.c' ---- - -# P019.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P019.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P019.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P019.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P020.md b/docs/semester_1/tuition-c/P020.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P020.c' -description: '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 %' -source: 'semester_1/tuition-c/P020.c' ---- - -# P020.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 % -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P020.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P020.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P020.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P021.md b/docs/semester_1/tuition-c/P021.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P021.c' -description: 'WAP to input a positive number and check if it is a perfect square number or not.' -source: 'semester_1/tuition-c/P021.c' ---- - -# P021.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to input a positive number and check if it is a perfect square number or not. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P021.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P021.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P021.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P022.md b/docs/semester_1/tuition-c/P022.md @@ -1,56 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P022.c' -description: 'WAP to find out smallest of three numbers without using if_else block.' -source: 'semester_1/tuition-c/P022.c' ---- - -# P022.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to find out smallest of three numbers without using if_else block. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P022.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P022.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P022.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P023.md b/docs/semester_1/tuition-c/P023.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P023.c' -description: 'WAP to input the total cost and compute the amount to be paid by the customer.' -source: 'semester_1/tuition-c/P023.c' ---- - -# P023.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to input the total cost and compute the amount to be paid by the customer. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P023.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P023.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P023.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P024.md b/docs/semester_1/tuition-c/P024.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P024.c' -description: 'WAP to check whether a year is leapyear or not.' -source: 'semester_1/tuition-c/P024.c' ---- - -# P024.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to check whether a year is leapyear or not. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P024.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P024.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P024.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P025.md b/docs/semester_1/tuition-c/P025.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P025.c' -description: '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.' -source: 'semester_1/tuition-c/P025.c' ---- - -# P025.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P025.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P025.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P025.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P026.md b/docs/semester_1/tuition-c/P026.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P026.c' -description: '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)' -source: 'semester_1/tuition-c/P026.c' ---- - -# P026.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P026.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P026.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P026.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P027.md b/docs/semester_1/tuition-c/P027.md @@ -1,98 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P027.c' -description: '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).' -source: 'semester_1/tuition-c/P027.c' ---- - -# P027.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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). -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P027.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P027.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P027.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P028.md b/docs/semester_1/tuition-c/P028.md @@ -1,73 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P028.c' -description: 'WAP to calculate factorial of a number' -source: 'semester_1/tuition-c/P028.c' ---- - -# P028.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate factorial of a number -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P028.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P028.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P028.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P029.md b/docs/semester_1/tuition-c/P029.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P029.c' -description: 'WAP to perform addition of first n natural numbers. sum = 1 + 2 + 3 + ...' -source: 'semester_1/tuition-c/P029.c' ---- - -# P029.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to perform addition of first n natural numbers. sum = 1 + 2 + 3 + ... -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P029.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P029.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P029.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P030.md b/docs/semester_1/tuition-c/P030.md @@ -1,101 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P030.c' -description: 'Display the first 15 terms of the series.' -source: 'semester_1/tuition-c/P030.c' ---- - -# P030.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Display the first 15 terms of the series. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P030.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P030.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P030.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P031.md b/docs/semester_1/tuition-c/P031.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P031.c' -description: 'Find the sum of the series' -source: 'semester_1/tuition-c/P031.c' ---- - -# P031.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Find the sum of the series -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P031.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P031.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P031.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P032.md b/docs/semester_1/tuition-c/P032.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P032.c' -description: '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' -source: 'semester_1/tuition-c/P032.c' ---- - -# P032.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P032.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P032.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P032.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P033.md b/docs/semester_1/tuition-c/P033.md @@ -1,65 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P033.c' -description: 'WAP to calculate the sum of even digits and odd digits. Number will be provided by user.' -source: 'semester_1/tuition-c/P033.c' ---- - -# P033.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to calculate the sum of even digits and odd digits. Number will be provided by user. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P033.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P033.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P033.c] -#include <stdio.h> -int main() -{ - int inp, odd = 0, even = 0, temp; - printf("Enter the number : "); - scanf("%d", &inp); - temp = inp; - while (temp > 0) - { - if ((temp % 10) % 2 == 0) - even += temp % 10; - else - odd += temp % 10; - temp /= 10; - } - printf("\nSum of even : %d" - "\nSum of odd : %d", - even, odd); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P034.md b/docs/semester_1/tuition-c/P034.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P034.c' -description: 'Get sum of even position digit and odd position digit' -source: 'semester_1/tuition-c/P034.c' ---- - -# P034.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Get sum of even position digit and odd position digit -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P034.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P034.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P034.c] -#include <stdio.h> -int main() -{ - int inp, temp, index = 1, even = 0, odd = 0; - printf("Enter the numebr : "); - scanf("%d", &inp); - temp = inp; - while (temp > 0) - { - if (index % 2 == 0) - even += temp % 10; - else - odd += temp % 10; - temp /= 10; - index++; - } - printf("\nSum of even position digits : %d" - "\nSum of odd position digits : %d", - even, odd); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P035.md b/docs/semester_1/tuition-c/P035.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P035.c' -description: 'WAP to input an int number and display the product of the successors of even digits of the number entered by user.' -source: 'semester_1/tuition-c/P035.c' ---- - -# P035.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to input an int number and display the product of the successors of even digits of the number entered by user. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P035.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P035.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P035.c] -#include <stdio.h> -#include <stdbool.h> -int main() -{ - int n, res = 1, temp; - bool status = false; - printf("Enter the number : "); - scanf("%d", &n); - temp = n; - while (temp > 0) - { - if ((temp % 10) % 2 == 0) - { - res *= (temp % 10) + 1; - status = true; - } - temp /= 10; - } - if (!status) - printf("\nThere is no even digits."); - else - printf("\nThe product of the successors of even digits of the number %d is : %d", n, res); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P036.md b/docs/semester_1/tuition-c/P036.md @@ -1,59 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P036.c' -description: 'sum = a + (a^2)/2 + (a^3)/3 + ... + (a^n)/n' -source: 'semester_1/tuition-c/P036.c' ---- - -# P036.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -sum = a + (a^2)/2 + (a^3)/3 + ... + (a^n)/n -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P036.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P036.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P036.c] -#include <stdio.h> -#include <math.h> - -int main() -{ - double a, sum = 0; - int n, i; - printf("Enter value for a and n : "); - scanf("%lf %d", &a, &n); - for (i = 1; i <= n; i++) - sum += pow(a, i) / i; - printf("\nSum = %g", sum); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P037.md b/docs/semester_1/tuition-c/P037.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P037.c' -description: 'sum = 1 + 1+2/1*2 + 1+2+3/1*2*3 + ... + 1+2+3+...+n/1*2*3*...*n' -source: 'semester_1/tuition-c/P037.c' ---- - -# P037.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -sum = 1 + 1+2/1*2 + 1+2+3/1*2*3 + ... + 1+2+3+...+n/1*2*3*...*n -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P037.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P037.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P037.c] -#include <stdio.h> - -int main() -{ - double sum = 0, temp1 = 0, temp2 = 1; - int n, i; - printf("Enter value for n : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - temp1 += i; - temp2 *= i; - sum += temp1 / temp2; - } - printf("\nSum = %g", sum); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P038.md b/docs/semester_1/tuition-c/P038.md @@ -1,98 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P038.c' -description: 'Write a program to check prime number' -source: 'semester_1/tuition-c/P038.c' ---- - -# P038.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check prime number -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P038.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P038.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P038.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P039.md b/docs/semester_1/tuition-c/P039.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P039.c' -description: 'Write a program to print all the factors of a postive integer' -source: 'semester_1/tuition-c/P039.c' ---- - -# P039.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to print all the factors of a postive integer -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P039.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P039.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P039.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P040.md b/docs/semester_1/tuition-c/P040.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P040.c' -description: 'Write a program to calculate HCF of two positive number' -source: 'semester_1/tuition-c/P040.c' ---- - -# P040.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to calculate HCF of two positive number -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P040.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P040.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P040.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P041.md b/docs/semester_1/tuition-c/P041.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P041.c' -description: 'Write a program to enter two numbers and check they are co-prime or not. co-prime when HCF = 1' -source: 'semester_1/tuition-c/P041.c' ---- - -# P041.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to enter two numbers and check they are co-prime or not. co-prime when HCF = 1 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P041.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P041.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P041.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P042.md b/docs/semester_1/tuition-c/P042.md @@ -1,96 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P042.c' -description: 'Write a program to accept a number and check whether the number is twisted prime or not.' -source: 'semester_1/tuition-c/P042.c' ---- - -# P042.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to accept a number and check whether the number is twisted prime or not. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P042.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P042.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P042.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P043.md b/docs/semester_1/tuition-c/P043.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P043.c' -description: 'Write a program to check palindrome number.' -source: 'semester_1/tuition-c/P043.c' ---- - -# P043.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to check palindrome number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P043.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P043.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P043.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P044.md b/docs/semester_1/tuition-c/P044.md @@ -1,112 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P044.c' -description: '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' -source: 'semester_1/tuition-c/P044.c' ---- - -# P044.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -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 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P044.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P044.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P044.c] -#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; -} -``` diff --git a/docs/semester_1/tuition-c/P045.md b/docs/semester_1/tuition-c/P045.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P045.c' -description: 'Make this pattern for input n. Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5' -source: 'semester_1/tuition-c/P045.c' ---- - -# P045.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Make this pattern for input n. Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P045.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P045.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P045.c] -#include <stdio.h> - -int main() -{ - int i, j, n; - printf("Enter n : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - for (j = 1; j <= i; j++) - { - printf("%d\t", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P046.md b/docs/semester_1/tuition-c/P046.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P046.c' -description: 'Make this pattern for input n. Pattern : 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1' -source: 'semester_1/tuition-c/P046.c' ---- - -# P046.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Make this pattern for input n. Pattern : 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P046.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P046.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P046.c] -#include <stdio.h> - -int main() -{ - int i, j, n; - printf("Enter n : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - for (j = i; j >= 1; j--) - { - printf("%d\t", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P047.md b/docs/semester_1/tuition-c/P047.md @@ -1,62 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P047.c' -description: 'Make this pattern for input n. Pattern : 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1' -source: 'semester_1/tuition-c/P047.c' ---- - -# P047.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Make this pattern for input n. Pattern : 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P047.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P047.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P047.c] -#include <stdio.h> - -int main() -{ - int i, j, n; - printf("Enter n : "); - scanf("%d", &n); - for (i = n; i >= 1; i--) - { - for (j = n; j >= i; j--) - { - printf("%d\t", j); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P048.md b/docs/semester_1/tuition-c/P048.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P048.c' -description: 'Make this pattern for input n no of row. Pattern : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15' -source: 'semester_1/tuition-c/P048.c' ---- - -# P048.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Make this pattern for input n no of row. Pattern : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P048.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P048.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P048.c] -#include <stdio.h> - -int main() -{ - int i, j, n, temp = 1; - printf("Enter row number : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - for (j = 1; j <= i; j++) - { - printf("%d\t", temp); - temp++; - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P049.md b/docs/semester_1/tuition-c/P049.md @@ -1,66 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P049.c' -description: 'Make this pattern for input n no of row. Pattern : # @ @ # # # @ @ @ @ # # # # #' -source: 'semester_1/tuition-c/P049.c' ---- - -# P049.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Make this pattern for input n no of row. Pattern : # @ @ # # # @ @ @ @ # # # # # -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P049.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P049.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P049.c] -#include <stdio.h> - -int main() -{ - int i, j, n; - char a = '#', b = '@'; - printf("Enter row number : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - for (j = 1; j <= i; j++) - { - if (i % 2 == 0) - printf("%c\t", b); - else - printf("%c\t", a); - } - printf("\n"); - } - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P050-SHORT.md b/docs/semester_1/tuition-c/P050-SHORT.md @@ -1,68 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P050-SHORT.c' -description: 'Write a program to input a number and check whether it is Disarium Number or not. Note : A number is said to Disarium if sum of its digit powered by with their respective position is equal to the original number.' -source: 'semester_1/tuition-c/P050-SHORT.c' ---- - -# P050-SHORT.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to input a number and check whether it is Disarium Number or not. Note : A number is said to Disarium if sum of its digit powered by with their respective position is equal to the original number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P050-SHORT.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P050-SHORT.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P050-SHORT.c] -#include <stdio.h> -#include <math.h> - -int main() -{ - int num; - printf("Enter the number : "); - scanf("%d", &num); - int position = printf("%d", num); - int temp = num; - int res = 0; - while (temp > 0) - { - res += (int)pow(temp % 10, position); - position--; - temp /= 10; - } - if (res == num) - printf(" is a Disarium Number."); - else - printf(" is Not a Disarium Number."); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P050.md b/docs/semester_1/tuition-c/P050.md @@ -1,72 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P050.c' -description: 'Write a program to input a number and check whether it is Disarium Number or not. Note : A number is said to Disarium if sum of its digit powered by with their respective position is equal to the original number.' -source: 'semester_1/tuition-c/P050.c' ---- - -# P050.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to input a number and check whether it is Disarium Number or not. Note : A number is said to Disarium if sum of its digit powered by with their respective position is equal to the original number. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P050.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P050.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P050.c] -#include <stdio.h> -#include <math.h> - -int main() -{ - int num, res = 0, temp, position = 0; - printf("Enter the number : "); - scanf("%d", &num); - temp = num; - while (temp > 0) - { - position++; - temp /= 10; - } - temp = num; - while (temp > 0) - { - res += (int)pow(temp % 10, position); - position--; - temp /= 10; - } - if (res == num) - printf("\nInput %d is a Disarium Number.", num); - else - printf("\nInput %d is Not a Disarium Number.", num); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P051.md b/docs/semester_1/tuition-c/P051.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P051.c' -description: 'Write a program to input two number and check whether they are Amicable Pair or not Example : Sum of Proper Divisors of 220 (1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110) = 284 Sum of Proper Divisors of 284 (1, 2, 4, 71, 142) = 220' -source: 'semester_1/tuition-c/P051.c' ---- - -# P051.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to input two number and check whether they are Amicable Pair or not Example : Sum of Proper Divisors of 220 (1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110) = 284 Sum of Proper Divisors of 284 (1, 2, 4, 71, 142) = 220 -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P051.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P051.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P051.c] -#include <stdio.h> - -int main() -{ - int a, b, i, sa = 0, sb = 0; - printf("Enter two number : "); - scanf("%d %d", &a, &b); - for (i = 1; i <= a / 2; i++) - if (a % i == 0) - sa += i; - for (i = 1; i <= b / 2; i++) - if (b % i == 0) - sb += i; - if (sa == b && sb == a) - printf("\nInput %d and %d is Amicable Pair.", a, b); - else - printf("\nInput %d and %d is Not Amicable Pair.", a, b); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P052.md b/docs/semester_1/tuition-c/P052.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P052.c' -description: 'Print the sum of this series for upto n element. Series: 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3 + 4) + ... + (1 + 2 + 3 + ... + n)' -source: 'semester_1/tuition-c/P052.c' ---- - -# P052.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Print the sum of this series for upto n element. Series: 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3 + 4) + ... + (1 + 2 + 3 + ... + n) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P052.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P052.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P052.c] -#include <stdio.h> - -int main() -{ - int n, sum = 0, temp = 0, i; - printf("Enter the n : "); - scanf("%d", &n); - for (i = 1; i <= n; i++) - { - temp += i; - sum += temp; - } - printf("%d", sum); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P053.md b/docs/semester_1/tuition-c/P053.md @@ -1,195 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P053.c' -description: 'Print all pattern' -source: 'semester_1/tuition-c/P053.c' ---- - -# P053.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Print all pattern -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P053.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P053.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P053.c] -#include <stdio.h> - -int main() -{ - int i, j, temp; - - printf("\n\nPattern 1 : \n\n"); - /* - 9 9 9 9 9 - 7 7 7 7 7 - 5 5 5 5 5 - 3 3 3 3 3 - 1 1 1 1 1 - */ - temp = 9; - for (i = 1; i <= 5; i++) - { - for (j = 1; j <= 5; j++) - { - printf("%d ", temp); - } - printf("\n"); - temp -= 2; - } - - // Another method print above pattern - printf("\n\nPattern 1 : \n\n"); - for (i = 9; i >= 1; i -= 2) - { - for (j = 1; j <= 5; j++) - { - printf("%d ", i); - } - printf("\n"); - } - - printf("\n\nPattern 2 : \n\n"); - /* - 1 2 3 4 5 - 1 2 3 4 5 - 1 2 3 4 5 - */ - for (i = 1; i <= 3; i++) - { - for (j = 1; j <= 5; j++) - { - printf("%d ", j); - } - printf("\n"); - } - - printf("\n\nPattern 3 : \n\n"); - /* - 5 4 3 2 1 - 5 4 3 2 1 - */ - for (i = 1; i <= 2; i++) - { - for (j = 5; j >= 1; j--) - { - printf("%d ", j); - } - printf("\n"); - } - - printf("\n\nPattern 4 : \n\n"); - /* - 1 2 3 4 - 5 6 7 8 - 9 10 11 12 - */ - temp = 1; - for (i = 1; i <= 3; i++) - { - for (j = 1; j <= 4; j++) - { - printf("%d ", temp); - temp++; - } - printf("\n"); - } - - printf("\n\nPattern 5 : \n\n"); - /* - 1 2 3 4 - 4 8 12 16 - 1 2 3 4 - 4 8 12 16 - 1 2 3 4 - */ - for (i = 1; i <= 5; i++) - { - for (j = 1; j <= 4; j++) - { - if (i % 2 == 0) - printf("%d ", j * 4); - else - printf("%d ", j); - } - printf("\n"); - } - - printf("\n\nPattern 6 : \n\n"); - /* - 1 - 2 4 - 3 5 7 - 6 8 10 12 - 9 11 13 15 17 - */ - int odd = 1, even = 2; - for (i = 1; i <= 5; i++) - { - for (j = 1; j <= i; j++) - { - if (i % 2 == 0) - { - printf("%d ", even); - even += 2; - } - else - { - printf("%d ", odd); - odd += 2; - } - } - printf("\n"); - } - - printf("\n\nPattern 7 : \n\n"); - /* - 1 2 3 4 5 - 6 7 8 9 - 10 11 12 - 13 14 - 15 - */ - temp = 1; - for (i = 5; i >= 1; i--) - { - for (j = 1; j <= i; j++) - { - printf("%d ", temp); - temp++; - } - printf("\n"); - } - - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P054.md b/docs/semester_1/tuition-c/P054.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P054.c' -description: 'WAP to check Krishnamurty number using user defined methods/functions.' -source: 'semester_1/tuition-c/P054.c' ---- - -# P054.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to check Krishnamurty number using user defined methods/functions. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P054.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P054.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P054.c] -#include <stdio.h> - -int fact(int); -int isKrishnamurty(int); - -int fact(int n) -{ - int fact = 1, i; - for (i = 1; i <= n; i++) - fact *= i; - return fact; -} - -int isKrishnamurty(int n) -{ - int temp = n, sum = 0; - while (temp > 0) - { - sum += fact(temp % 10); - temp /= 10; - } - return n == sum; -} - -int main() -{ - int n; - printf("Enter the number : "); - scanf("%d", &n); - if (isKrishnamurty(n)) - printf("\nInput %d is a Krishnamurty Number.", n); - else - printf("\nInput %d is not a Krishnamurty number.", n); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P055.md b/docs/semester_1/tuition-c/P055.md @@ -1,76 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P055.c' -description: 'WAP to print n terms of Fibbonacci Series (Starting from term 0)' -source: 'semester_1/tuition-c/P055.c' ---- - -# P055.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to print n terms of Fibbonacci Series (Starting from term 0) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P055.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P055.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P055.c] -#include <stdio.h> - -void printFibonacci(int); - -void printFibonacci(int n) -{ - int val1 = 0, val2 = 1, val3, i; - printf("\nFibonacci series upto %d terms :", n); - if (n < 0) - printf(" N/A"); - if (n == 0) - printf(" %d", val1); - if (n > 0) - printf(" %d %d", val1, val2); - for (i = 2; i <= n; i++) - { - val3 = val1 + val2; - printf(" %d", val3); - val1 = val2; - val2 = val3; - } -} - -int main() -{ - int n; - printf("Enter the n : "); - scanf("%d", &n); - printFibonacci(n); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P056.md b/docs/semester_1/tuition-c/P056.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P056.c' -description: 'WAP to swap the value of a and b using user defined method.' -source: 'semester_1/tuition-c/P056.c' ---- - -# P056.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to swap the value of a and b using user defined method. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P056.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P056.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P056.c] -#include <stdio.h> - -void swap(int *a, int *b) -{ - int temp = *a; - *a = *b; - *b = temp; -} - -int main() -{ - int a, b; - printf("Enter A and B: "); - scanf("%d %d", &a, &b); - printf("\nBefore swap A: %d, B: %d", a, b); - swap(&a, &b); - printf("\nAfter swap A: %d, B: %d", a, b); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P057.md b/docs/semester_1/tuition-c/P057.md @@ -1,63 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P057.c' -description: 'WAP to display the series using user defined method. 0, 7, 26, 63, ... upto n terms using void series(int n)' -source: 'semester_1/tuition-c/P057.c' ---- - -# P057.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to display the series using user defined method. 0, 7, 26, 63, ... upto n terms using void series(int n) -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P057.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P057.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P057.c] -#include <stdio.h> - -void series(int n) -{ - int i; - printf("\nSeries: "); - for (i = 1; i <= n; i++) - printf("%d ", (i * i * i) - 1); -} - -int main() -{ - int n; - printf("Enter n: "); - scanf("%d", &n); - series(n); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P058.md b/docs/semester_1/tuition-c/P058.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P058.c' -description: 'WAP to display ASCII code of Alphabets (A - Z) using void displayASCII()' -source: 'semester_1/tuition-c/P058.c' ---- - -# P058.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to display ASCII code of Alphabets (A - Z) using void displayASCII() -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P058.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P058.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P058.c] -#include <stdio.h> - -void displayASCII() -{ - int i; - printf("ASCII Code\t\tCharacter"); - for (i = 'A'; i <= 'Z'; i++) - printf("\n%c\t\t%d", i, i); -} - -int main() -{ - displayASCII(); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P059.md b/docs/semester_1/tuition-c/P059.md @@ -1,97 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P059.c' -description: 'Write a program to find the sum of array elements using following fuctions int array_sum(int a[], int n); void get_data(int a[], int n); void dispaly(int a[], int n);' -source: 'semester_1/tuition-c/P059.c' ---- - -# P059.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 12 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to find the sum of array elements using following fuctions int array_sum(int a[], int n); void get_data(int a[], int n); void dispaly(int a[], int n); -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P059.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P059.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P059.c] -#include <stdio.h> - -int array_sum(int[], int); -void get_data(int[], int); -void display(int[], int); - -int main() -{ - int size, arr[20]; - printf("How many element do you want to add (Max: 20): "); - scanf("%d", &size); - if (size < 1 && size > 20) - { - printf("\nMax Element count is 20."); - return 1; - } - get_data(arr, size); - display(arr, size); - printf("\nSum of the elements is: %d", array_sum(arr, size)); - return 0; -} - -void get_data(int a[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element for position %d: ", i); - scanf("%d", &a[i]); - } -} - -void display(int a[], int n) -{ - int i; - printf("\nArray: ["); - for (i = 0; i < n; i++) - { - printf("%d", a[i]); - if (i != n - 1) - printf(", "); - } - printf("]\n"); -} - -int array_sum(int a[], int n) -{ - int i, sum = 0; - for (i = 0; i < n; i++) - sum += a[i]; - return sum; -} -``` diff --git a/docs/semester_1/tuition-c/P060.md b/docs/semester_1/tuition-c/P060.md @@ -1,93 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P060.c' -description: 'write a C program to count the occurrences of a given element in an array using a user-defined function. Create a function int count_occurrences(int arr[], int n, int target) that countts how many times target appears in the array.' -source: 'semester_1/tuition-c/P060.c' ---- - -# P060.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 13 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -write a C program to count the occurrences of a given element in an array using a user-defined function. Create a function int count_occurrences(int arr[], int n, int target) that countts how many times target appears in the array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P060.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P060.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P060.c] -#include <stdio.h> - -int count_occurrences(int[], int, int); -void inputarr(int[], int); - -int main() -{ - int n, arr[20], target, found; - printf("Enter the n (Max: 20): "); - scanf("%d", &n); - inputarr(arr, n); - printf("Enter the target: "); - scanf("%d", &target); - found = count_occurrences(arr, n, target); - if (found) - { - printf("\n%d found %d times.", target, found); - } - else - { - printf("\n%d is not found.", target); - } - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int count_occurrences(int arr[], int n, int target) -{ - int count = 0; - int i; - for (i = 0; i < n; i++) - { - if (arr[i] == target) - { - count++; - } - } - return count; -} -``` diff --git a/docs/semester_1/tuition-c/P061.md b/docs/semester_1/tuition-c/P061.md @@ -1,82 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P061.c' -description: 'Write a C program to find the sum of even elements in an array using a user defined function. Define a functions int sumEven(int arr[], int n) that returns the sum of all even elements in the array.' -source: 'semester_1/tuition-c/P061.c' ---- - -# P061.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 14 Dec 2025 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to find the sum of even elements in an array using a user defined function. Define a functions int sumEven(int arr[], int n) that returns the sum of all even elements in the array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P061.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P061.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P061.c] -#include <stdio.h> - -void inputarr(int[], int); -int sumEven(int[], int); - -int main() -{ - int arr[20], n; - printf("Enter the n (Max: 20): "); - scanf("%d", &n); - inputarr(arr, n); - printf("\nSum of the even number in the array: %d", sumEven(arr, n)); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int sumEven(int arr[], int n) -{ - int i, sum_even = 0; - for (i = 0; i < n; i++) - { - if (arr[i] % 2 == 0) - { - sum_even += arr[i]; - } - } - return sum_even; -} -``` diff --git a/docs/semester_1/tuition-c/P062.md b/docs/semester_1/tuition-c/P062.md @@ -1,100 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P062.c' -description: 'Write a C program to find the smallest and largest in an array using user-defined functions. Define two functions int findSmallest(int arr[], int n) and int findLargest(int arr[], int n) that return the smallest and largest elements in an array, respectively.' -source: 'semester_1/tuition-c/P062.c' ---- - -# P062.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 16 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to find the smallest and largest in an array using user-defined functions. Define two functions int findSmallest(int arr[], int n) and int findLargest(int arr[], int n) that return the smallest and largest elements in an array, respectively. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P062.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P062.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P062.c] -#include <stdio.h> -#include <stdlib.h> - -void inputarr(int[], int); -int findSmallest(int[], int); -int findLargest(int[], int); - -int main() -{ - int n, *arr; - printf("How many element do you want to enter: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - inputarr(arr, n); - printf("\nSmallest element = %d", findSmallest(arr, n)); - printf("\nLargest element = %d", findLargest(arr, n)); - free(arr); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter Element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int findSmallest(int arr[], int n) -{ - int i, smallest = arr[0]; - for (i = 1; i < n; i++) - { - if (smallest > arr[i]) - { - smallest = arr[i]; - } - } - return smallest; -} - -int findLargest(int arr[], int n) -{ - int i, largest = arr[0]; - for (i = 1; i < n; i++) - { - if (largest < arr[i]) - { - largest = arr[i]; - } - } - return largest; -} -``` diff --git a/docs/semester_1/tuition-c/P063.md b/docs/semester_1/tuition-c/P063.md @@ -1,93 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P063.c' -description: 'Write a C program to find all Niven in an array. Define a user-defined function int isNiven(int num) that returns 1 if the numbers is a Niven number, otherwise returns 0. A Niven number (also known as a Harshad Number) is an integer that is divisible by the sum of its digits.' -source: 'semester_1/tuition-c/P063.c' ---- - -# P063.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 16 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a C program to find all Niven in an array. Define a user-defined function int isNiven(int num) that returns 1 if the numbers is a Niven number, otherwise returns 0. A Niven number (also known as a Harshad Number) is an integer that is divisible by the sum of its digits. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P063.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P063.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P063.c] -#include <stdio.h> -#include <stdlib.h> - -void inputarr(int[], int); -int isNiven(int); - -int main() -{ - int n, *arr, i; - printf("How many element do you want to enter: "); - scanf("%d", &n); - arr = (int *)malloc(n * sizeof(int)); - inputarr(arr, n); - for (i = 0; i < n; i++) - { - if (isNiven(arr[i])) - { - printf("\n%d is a Niven number.", arr[i]); - } - else - { - printf("\n%d is a NOT Niven number.", arr[i]); - } - } - free(arr); - return 0; -} - -void inputarr(int arr[], int n) -{ - int i; - for (i = 0; i < n; i++) - { - printf("Enter Element %d: ", i + 1); - scanf("%d", &arr[i]); - } -} - -int isNiven(int num) -{ - int i, sum = 0, temp = num; - while (temp > 0) - { - sum += temp % 10; - temp /= 10; - } - return num % sum == 0; -} -``` diff --git a/docs/semester_1/tuition-c/P064.md b/docs/semester_1/tuition-c/P064.md @@ -1,92 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P064.c' -description: 'Write a program to merge two sorted integer arrays to form a single sorted array.' -source: 'semester_1/tuition-c/P064.c' ---- - -# P064.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 21 Dec 2025 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to merge two sorted integer arrays to form a single sorted array. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P064.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P064.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P064.c] -#include <stdio.h> -#include <stdlib.h> - -void merge(int[], int, int[], int); - -int main() -{ - int a[] = {10, 30, 50, 70, 90}; - int b[] = {20, 40, 60, 80, 100}; - int n1 = sizeof(a) / sizeof(a[0]); - int n2 = sizeof(b) / sizeof(b[0]); - merge(a, n1, b, n2); - return 0; -} - -void merge(int a[], int n1, int b[], int n2) -{ - int n = n1 + n2; - int *c = (int *)malloc(n * sizeof(int)); - int i, j, k; - i = j = k = 0; - while (i < n1 && j < n2) - { - if (a[i] < b[j]) - { - c[k++] = a[i++]; - } - else - { - c[k++] = b[j++]; - } - } - while (i < n1) - { - c[k++] = a[i++]; - } - while (j < n2) - { - c[k++] = b[j++]; - } - printf("Merged Array:"); - for (i = 0; i < n; i++) - { - printf(" %d", c[i]); - } - free(c); -} -``` diff --git a/docs/semester_1/tuition-c/P065.md b/docs/semester_1/tuition-c/P065.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P065.c' -description: 'Write a program to reverse a string' -source: 'semester_1/tuition-c/P065.c' ---- - -# P065.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 12 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to reverse a string -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P065.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P065.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P065.c] -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -void str_rev(char[]); - -int main() -{ - char str[101]; - printf("Enter the string (Max: 100 Character): "); - gets(str); - printf("\nBefore Reverse: %s", str); - str_rev(str); - printf("\nAfter Reverse: %s", str); - return 0; -} - -void str_rev(char str[]) -{ - int i, j; - char temp; - i = 0; - j = strlen(str) - 1; // not taking the null - while (i < j) - { - temp = str[i]; - str[i] = str[j]; - str[j] = temp; - i++; - j--; - } -} -``` diff --git a/docs/semester_1/tuition-c/P066.md b/docs/semester_1/tuition-c/P066.md @@ -1,69 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P066.c' -description: 'WAP to find the length of a string using i) Library Method ii) User defined method' -source: 'semester_1/tuition-c/P066.c' ---- - -# P066.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 14 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -WAP to find the length of a string using i) Library Method ii) User defined method -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P066.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P066.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P066.c] -#include <stdio.h> -#include <string.h> - -int sLength(char str[]) -{ - int i = 0; - while (str[i] != '\0') - { - i++; - } - return i; -} - -int main() -{ - char str[30]; - int len; - printf("Enter the string: "); - gets(str); - len = strlen(str); - printf("Length of the string: %d", len); - printf("\nLength of the string (U-D): %d", len); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P067.md b/docs/semester_1/tuition-c/P067.md @@ -1,74 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P067.c' -description: 'Write a program using function which concatenates two string s1 and s2 in to a third string' -source: 'semester_1/tuition-c/P067.c' ---- - -# P067.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 14 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using function which concatenates two string s1 and s2 in to a third string -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P067.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P067.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P067.c] -#include <stdio.h> - -void string_concat(char *s3, char s1[], char s2[]) -{ - int l1, l2, i, j, k; - i = j = k = 0; - l1 = strlen(s1); - l2 = strlen(s2); - s3 = (char *)malloc((l1 + l2 + 1) * sizeof(char)); - while (s1[i] != '\0') - { - s3[k++] = s1[i++]; - } - while (s2[j] != '\0') - { - s3[k++] = s2[j++]; - } - s3[k] = '\0'; - puts(s3); -} - -int main() -{ - char s1[] = "JAVA"; - char s2[] = "PYTHON"; - char *s3 = NULL; - string_concat(s3, s1, s2); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P068.md b/docs/semester_1/tuition-c/P068.md @@ -1,83 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P068.c' -description: 'Write a c program that perform the operation of strcmp()' -source: 'semester_1/tuition-c/P068.c' ---- - -# P068.c - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 14 Jan 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a c program that perform the operation of strcmp() -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P068.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P068.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P068.c] -#include <stdio.h> -#include <stdlib.h> - -int string_compare1(char s1[], char s2[]) -{ - int i, c, cmp = 0, p = 0; - i = 0; - while (s1[i] != '\0' && s2[i] != '\0') - { - if (s1[i] != s2[i]) - { - cmp = s1[i] - s2[i]; - p = 1; - break; - } - i++; - } - c = s1[i] != '\0' ? s1[i] : (-1) * s2[i]; - return p == 1 ? cmp : c; -} -int string_compare2(char *s1, char *s2) -{ - while (*s1 != '\0' && (*s1 == *s2)) - { - s1++; - s2++; - } - return *s1 - *s2; -} - -int main() -{ - char str1[] = "AMIT"; - char str2[] = "Amit"; - printf("Result 1 = %d", string_compare1(str1, str2)); - printf("\nResult 2 = %d", string_compare2(str1, str2)); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P069.md b/docs/semester_1/tuition-c/P069.md @@ -1,99 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P069.c' -description: 'Write a program using user defined method to implement the following JAVA PROG Mastery -> JPM java prog mastery -> JPM Acharya Prafulla Chandra -> JPM' -source: 'semester_1/tuition-c/P069.c' ---- - -# P069.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 14 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program using user defined method to implement the following JAVA PROG Mastery -> JPM java prog mastery -> JPM Acharya Prafulla Chandra -> JPM -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P069.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P069.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P069.c] -#include <stdio.h> -#include <ctype.h> - -void _short_1(char str[]) -{ - int i = 0, j = 0; - char s[10]; - if (str[0] != '\0' && str[0] != ' ') - { - s[j] = toupper(str[j]); - i++; - j++; - } - while (str[i] != '\0') - { - if (str[i] == ' ') - { - s[j] = toupper(str[i + 1]); - i++; - j++; - } - i++; - } - s[j] = '\0'; - printf("\nResult 1: %s", s); -} - -void _short_2(char str[]) -{ - int i, j; - char strnew[10]; - strnew[0] = toupper(str[0]); - i = j = 1; - while (str[i] != '\0') - { - if (str[i] == ' ') - { - strnew[j++] = toupper(str[i + 1]); - } - i++; - } - strnew[j] = '\0'; - printf("\nResult 2: %s", strnew); -} - -int main() -{ - char str[30]; - printf("Enter the string: "); - gets(str); - _short_1(str); - _short_2(str); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/P070.md b/docs/semester_1/tuition-c/P070.md @@ -1,88 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> P070.c' -description: 'Write a program to perform addition of two complex number having fields ''real'' and ''img'' of type integer.' -source: 'semester_1/tuition-c/P070.c' ---- - -# P070.c - -### Metadata - -- **Author** — [Amit Dutta](mailto:amitdutta4255@gmail.com) -- **Last updated** — 24 Jan 2026 -- **License** — [MIT License (See the LICENSE file for details)](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Write a program to perform addition of two complex number having fields 'real' and 'img' of type integer. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_1/tuition-c/P070.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_1/tuition-c/P070.c" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```c [P070.c] -#include <stdio.h> - -struct complex -{ - int real; - int img; -}; - -void getData(struct complex *c) -{ - printf("Enter real: "); - scanf("%d", &c->real); - printf("Enter imaginary: "); - scanf("%d", &c->img); -} - -struct complex add(struct complex c1, struct complex c2) -{ - struct complex r; - r.real = c1.real + c2.real; - r.img = c1.img + c2.img; - return r; -} - -void display(struct complex c) -{ - printf("%d+%di", c.real, c.img); -} - -int main() -{ - struct complex c1, c2, c3; - getData(&c1); - getData(&c2); - printf("\nComplex Number 1:\n"); - display(c1); - printf("\nComplex Number 2:\n"); - display(c2); - c3 = add(c1, c2); - printf("\nResult: \n"); - display(c3); - return 0; -} -``` diff --git a/docs/semester_1/tuition-c/index.md b/docs/semester_1/tuition-c/index.md @@ -1,144 +0,0 @@ -# Tuition C - -Files and sub-folders in **Tuition C**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `APC-PRAC-001.c` | [View Code](APC-PRAC-001.md) | -| 2 | `APC-PRAC-002.c` | [View Code](APC-PRAC-002.md) | -| 3 | `APC-PRAC-003.c` | [View Code](APC-PRAC-003.md) | -| 4 | `APC-PRAC-004.c` | [View Code](APC-PRAC-004.md) | -| 5 | `APC-PRAC-005.c` | [View Code](APC-PRAC-005.md) | -| 6 | `APC-PRAC-006.c` | [View Code](APC-PRAC-006.md) | -| 7 | `APC-PRAC-007.c` | [View Code](APC-PRAC-007.md) | -| 8 | `APC-PRAC-008.c` | [View Code](APC-PRAC-008.md) | -| 9 | `APC-PRAC-009.c` | [View Code](APC-PRAC-009.md) | -| 10 | `APC-PRAC-010.c` | [View Code](APC-PRAC-010.md) | -| 11 | `APC-PRAC-011.c` | [View Code](APC-PRAC-011.md) | -| 12 | `APC-PRAC-012.c` | [View Code](APC-PRAC-012.md) | -| 13 | `APC-PRAC-013.c` | [View Code](APC-PRAC-013.md) | -| 14 | `APC-PRAC-014.c` | [View Code](APC-PRAC-014.md) | -| 15 | `APC-PRAC-015.c` | [View Code](APC-PRAC-015.md) | -| 16 | `APC-PRAC-016.c` | [View Code](APC-PRAC-016.md) | -| 17 | `APC-PRAC-017.c` | [View Code](APC-PRAC-017.md) | -| 18 | `APC-PRAC-018.c` | [View Code](APC-PRAC-018.md) | -| 19 | `APC-PRAC-019.c` | [View Code](APC-PRAC-019.md) | -| 20 | `APC-PRAC-020.c` | [View Code](APC-PRAC-020.md) | -| 21 | `APC-PRAC-021.c` | [View Code](APC-PRAC-021.md) | -| 22 | `APC-PRAC-022.c` | [View Code](APC-PRAC-022.md) | -| 23 | `APC-PRAC-023.c` | [View Code](APC-PRAC-023.md) | -| 24 | `APC-PRAC-024.c` | [View Code](APC-PRAC-024.md) | -| 25 | `APC-PRAC-025.c` | [View Code](APC-PRAC-025.md) | -| 26 | `APC-PRAC-026.c` | [View Code](APC-PRAC-026.md) | -| 27 | `APC-PRAC-027.c` | [View Code](APC-PRAC-027.md) | -| 28 | `APC-PRAC-028.c` | [View Code](APC-PRAC-028.md) | -| 29 | `APC-PRAC-029.c` | [View Code](APC-PRAC-029.md) | -| 30 | `APC-PRAC-030.c` | [View Code](APC-PRAC-030.md) | -| 31 | `APC-PRAC-031.c` | [View Code](APC-PRAC-031.md) | -| 32 | `APC-PRAC-032.c` | [View Code](APC-PRAC-032.md) | -| 33 | `APC-PRAC-033.c` | [View Code](APC-PRAC-033.md) | -| 34 | `APC-PRAC-034.c` | [View Code](APC-PRAC-034.md) | -| 35 | `APC-PRAC-035.c` | [View Code](APC-PRAC-035.md) | -| 36 | `APC-PRAC-036.c` | [View Code](APC-PRAC-036.md) | -| 37 | `APC-PRAC-037.c` | [View Code](APC-PRAC-037.md) | -| 38 | `APC-PRAC-038.c` | [View Code](APC-PRAC-038.md) | -| 39 | `APC-PRAC-039.c` | [View Code](APC-PRAC-039.md) | -| 40 | `APC-PRAC-040.c` | [View Code](APC-PRAC-040.md) | -| 41 | `APC-PRAC-041.c` | [View Code](APC-PRAC-041.md) | -| 42 | `APC-PRAC-042.c` | [View Code](APC-PRAC-042.md) | -| 43 | `APC-S-001.c` | [View Code](APC-S-001.md) | -| 44 | `APC-S-002.c` | [View Code](APC-S-002.md) | -| 45 | `APC-S-003.c` | [View Code](APC-S-003.md) | -| 46 | `APC-S-004.c` | [View Code](APC-S-004.md) | -| 47 | `APC-S-005.c` | [View Code](APC-S-005.md) | -| 48 | `APC-S-006.c` | [View Code](APC-S-006.md) | -| 49 | `APC-S-007.c` | [View Code](APC-S-007.md) | -| 50 | `APC-S-008.c` | [View Code](APC-S-008.md) | -| 51 | `APC-S-009.c` | [View Code](APC-S-009.md) | -| 52 | `APC-S-010.c` | [View Code](APC-S-010.md) | -| 53 | `APC-S-011.c` | [View Code](APC-S-011.md) | -| 54 | `APC-S-012.c` | [View Code](APC-S-012.md) | -| 55 | `APC-S-013.c` | [View Code](APC-S-013.md) | -| 56 | `APC-S-014.c` | [View Code](APC-S-014.md) | -| 57 | `APC-SPS-001.c` | [View Code](APC-SPS-001.md) | -| 58 | `APC-SPS-002.c` | [View Code](APC-SPS-002.md) | -| 59 | `APC-SPS-003.c` | [View Code](APC-SPS-003.md) | -| 60 | `APC-SPS-004.c` | [View Code](APC-SPS-004.md) | -| 61 | `APC-SPS-005.c` | [View Code](APC-SPS-005.md) | -| 62 | `APC-SPS-006.c` | [View Code](APC-SPS-006.md) | -| 63 | `APC-SPS-007.c` | [View Code](APC-SPS-007.md) | -| 64 | `APC-SPS-008.c` | [View Code](APC-SPS-008.md) | -| 65 | `P001.c` | [View Code](P001.md) | -| 66 | `P002.c` | [View Code](P002.md) | -| 67 | `P003.c` | [View Code](P003.md) | -| 68 | `P004.c` | [View Code](P004.md) | -| 69 | `P005.c` | [View Code](P005.md) | -| 70 | `P006.c` | [View Code](P006.md) | -| 71 | `P007.c` | [View Code](P007.md) | -| 72 | `P008.c` | [View Code](P008.md) | -| 73 | `P009.c` | [View Code](P009.md) | -| 74 | `P010.c` | [View Code](P010.md) | -| 75 | `P011.c` | [View Code](P011.md) | -| 76 | `P012.c` | [View Code](P012.md) | -| 77 | `P013.c` | [View Code](P013.md) | -| 78 | `P014.c` | [View Code](P014.md) | -| 79 | `P015.c` | [View Code](P015.md) | -| 80 | `P016.c` | [View Code](P016.md) | -| 81 | `P017.c` | [View Code](P017.md) | -| 82 | `P018.c` | [View Code](P018.md) | -| 83 | `P019.c` | [View Code](P019.md) | -| 84 | `P020.c` | [View Code](P020.md) | -| 85 | `P021.c` | [View Code](P021.md) | -| 86 | `P022.c` | [View Code](P022.md) | -| 87 | `P023.c` | [View Code](P023.md) | -| 88 | `P024.c` | [View Code](P024.md) | -| 89 | `P025.c` | [View Code](P025.md) | -| 90 | `P026.c` | [View Code](P026.md) | -| 91 | `P027.c` | [View Code](P027.md) | -| 92 | `P028.c` | [View Code](P028.md) | -| 93 | `P029.c` | [View Code](P029.md) | -| 94 | `P030.c` | [View Code](P030.md) | -| 95 | `P031.c` | [View Code](P031.md) | -| 96 | `P032.c` | [View Code](P032.md) | -| 97 | `P033.c` | [View Code](P033.md) | -| 98 | `P034.c` | [View Code](P034.md) | -| 99 | `P035.c` | [View Code](P035.md) | -| 100 | `P036.c` | [View Code](P036.md) | -| 101 | `P037.c` | [View Code](P037.md) | -| 102 | `P038.c` | [View Code](P038.md) | -| 103 | `P039.c` | [View Code](P039.md) | -| 104 | `P040.c` | [View Code](P040.md) | -| 105 | `P041.c` | [View Code](P041.md) | -| 106 | `P042.c` | [View Code](P042.md) | -| 107 | `P043.c` | [View Code](P043.md) | -| 108 | `P044.c` | [View Code](P044.md) | -| 109 | `P045.c` | [View Code](P045.md) | -| 110 | `P046.c` | [View Code](P046.md) | -| 111 | `P047.c` | [View Code](P047.md) | -| 112 | `P048.c` | [View Code](P048.md) | -| 113 | `P049.c` | [View Code](P049.md) | -| 114 | `P050-SHORT.c` | [View Code](P050-SHORT.md) | -| 115 | `P050.c` | [View Code](P050.md) | -| 116 | `P051.c` | [View Code](P051.md) | -| 117 | `P052.c` | [View Code](P052.md) | -| 118 | `P053.c` | [View Code](P053.md) | -| 119 | `P054.c` | [View Code](P054.md) | -| 120 | `P055.c` | [View Code](P055.md) | -| 121 | `P056.c` | [View Code](P056.md) | -| 122 | `P057.c` | [View Code](P057.md) | -| 123 | `P058.c` | [View Code](P058.md) | -| 124 | `P059.c` | [View Code](P059.md) | -| 125 | `P060.c` | [View Code](P060.md) | -| 126 | `P061.c` | [View Code](P061.md) | -| 127 | `P062.c` | [View Code](P062.md) | -| 128 | `P063.c` | [View Code](P063.md) | -| 129 | `P064.c` | [View Code](P064.md) | -| 130 | `P065.c` | [View Code](P065.md) | -| 131 | `P066.c` | [View Code](P066.md) | -| 132 | `P067.c` | [View Code](P067.md) | -| 133 | `P068.c` | [View Code](P068.md) | -| 134 | `P069.c` | [View Code](P069.md) | -| 135 | `P070.c` | [View Code](P070.md) | - diff --git a/docs/semester_2/algorithms/algo_01.md b/docs/semester_2/algorithms/algo_01.md @@ -1,32 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_01' -description: 'Write an algorithm to insert a node at the beginning.' -source: 'semester_2/algorithms/algo_01.md' ---- - -# algo_01 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to insert a node at the beginning. -::: - -## Algorithm -``` -procedure insert_begin(head) -begin - ptr ← get_node(); - print("Enter the value"); - read(val); - info(ptr) ← val; - next(ptr) ← NULL; - if(head = NULL) - head ← ptr; - else - next(ptr) ← head; - head ← ptr; - endif - return(head); -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_02.md b/docs/semester_2/algorithms/algo_02.md @@ -1,28 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_02' -description: 'Write an algorithm to delete the first node of the list.' -source: 'semester_2/algorithms/algo_02.md' ---- - -# algo_02 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to delete the first node of the list. -::: - -## Algorithm -``` -procedure delete_firstNode(head) -begin - if(head = NULL) - write("List is empty, Deletion is not possible."); - else - p ← head ; - head ← next(p); - delete(p); - endif - return(head); -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_03.md b/docs/semester_2/algorithms/algo_03.md @@ -1,29 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_03' -description: 'Write an algorithm to traverse a singly linked list.' -source: 'semester_2/algorithms/algo_03.md' ---- - -# algo_03 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to traverse a singly linked list. -::: - -## Algorithm -``` -procedure traverce(head) -begin - if(head = NULL) - write("List is empty"); - else - ptr ← head; - while(ptr ≠ NULL) - write(info(ptr)); - ptr ← next(ptr); - end while - end if -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_04.md b/docs/semester_2/algorithms/algo_04.md @@ -1,31 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_04' -description: 'Write an algorithm to count number of nodes in a singly linked list.' -source: 'semester_2/algorithms/algo_04.md' ---- - -# algo_04 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to count number of nodes in a singly linked list. -::: - -## Algorithm -``` -procedure count(head) -begin - count = 0; - if(head = NULL) - write(count); - else - ptr ← head; - while(ptr ≠ NULL) - count ← count + 1; - ptr ← next(ptr); - end while - write(count); - endif -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_05.md b/docs/semester_2/algorithms/algo_05.md @@ -1,34 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_05' -description: 'Write an algorithm to insert a node at the end of the list.' -source: 'semester_2/algorithms/algo_05.md' ---- - -# algo_05 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to insert a node at the end of the list. -::: - -## Algorithm -``` -procedure insertEnd(head) -begin - nptr ← getnode(); - write("Enter info: "); - read(val); - info(nptr) ← val; - if(head = NULL) - head ← nptr; - else - ptr ← head; - while(next(ptr) ≠ NULL) - ptr ← next(ptr); - end while - next(ptr) ← nptr; - endif - return(head); -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_06.md b/docs/semester_2/algorithms/algo_06.md @@ -1,36 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_06' -description: 'Write an algorithm to delete the last node of the list.' -source: 'semester_2/algorithms/algo_06.md' ---- - -# algo_06 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to delete the last node of the list. -::: - -## Algorithm -``` -procedure deletelastnode(head) -begin - if(head = NULL) - write("List is empty, deletion not possible."); - else if(next(head) = NULL) - ptr ← head; - head ← next(ptr); - delete(ptr); - else - ptr ← head; - while(next(ptr) ≠ NULL) - prev ← ptr; - ptr ← next(ptr); - end while - delete(ptr); - next(prev) ← NULL; - endif - return(head); -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_07.md b/docs/semester_2/algorithms/algo_07.md @@ -1,30 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_07' -description: 'Write an algorithm to search an element from a linked list.' -source: 'semester_2/algorithms/algo_07.md' ---- - -# algo_07 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to search an element from a linked list. -::: - -## Algorithm -``` -procedure search(head, key) -begin - isFound ← false; - ptr ← head; - while(ptr ≠ NULL) - if(info(ptr) = key) - isFound ← true; - break; - endif - ptr ← next(ptr); - end while - return(isFound); -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/algo_08.md b/docs/semester_2/algorithms/algo_08.md @@ -1,33 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;" class="lucide lucide-binary"><rect x="14" y="14" width="4" height="6" rx="2"/><rect x="6" y="4" width="4" height="6" rx="2"/><path d="M6 20h4"/><path d="M14 10h4"/><path d="M6 14h2v6"/><path d="M14 4h2v6"/></svg> algo_08' -description: 'Write an algorithm to find max element from the list.' -source: 'semester_2/algorithms/algo_08.md' ---- - -# algo_08 - -### Problem Statement - -::: tip Problem Statement -Write an algorithm to find max element from the list. -::: - -## Algorithm -``` -procedure findMax(head) -begin - if(head = NULL) - write("List is empty."); - else - ptr ← head; - max ← info(ptr); - while(ptr ≠ NULL) - if(max < info(ptr)) - max ← info(ptr); - endif - ptr ← next(ptr); - end while - return(max); - endif -end procedure -```- \ No newline at end of file diff --git a/docs/semester_2/algorithms/index.md b/docs/semester_2/algorithms/index.md @@ -1,17 +0,0 @@ -# Algorithms - -Files and sub-folders in **Algorithms**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `algo_01` | [View Code](algo_01.md) | -| 2 | `algo_02` | [View Code](algo_02.md) | -| 3 | `algo_03` | [View Code](algo_03.md) | -| 4 | `algo_04` | [View Code](algo_04.md) | -| 5 | `algo_05` | [View Code](algo_05.md) | -| 6 | `algo_06` | [View Code](algo_06.md) | -| 7 | `algo_07` | [View Code](algo_07.md) | -| 8 | `algo_08` | [View Code](algo_08.md) | - diff --git a/docs/semester_2/practice/index.md b/docs/semester_2/practice/index.md @@ -1,21 +0,0 @@ -# Practice - -Files and sub-folders in **Practice**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `prac_001.cpp` | [View Code](prac_001.md) | -| 2 | `prac_002.cpp` | [View Code](prac_002.md) | -| 3 | `prac_003.cpp` | [View Code](prac_003.md) | -| 4 | `prac_004.cpp` | [View Code](prac_004.md) | -| 5 | `prac_005.cpp` | [View Code](prac_005.md) | -| 6 | `prac_006.cpp` | [View Code](prac_006.md) | -| 7 | `prac_007.cpp` | [View Code](prac_007.md) | -| 8 | `prac_008.cpp` | [View Code](prac_008.md) | -| 9 | `prac_009.cpp` | [View Code](prac_009.md) | -| 10 | `prac_010.cpp` | [View Code](prac_010.md) | -| 11 | `prac_011.cpp` | [View Code](prac_011.md) | -| 12 | `prac_012.cpp` | [View Code](prac_012.md) | - diff --git a/docs/semester_2/practice/prac_001.md b/docs/semester_2/practice/prac_001.md @@ -1,60 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_001.cpp' -description: 'Trying to remember after a year.' -source: 'semester_2/practice/prac_001.cpp' ---- - -# prac_001.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 18 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Trying to remember after a year. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_001.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_001.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_001.cpp] -#include <iostream> -using namespace std; - -int main() { - int n; - cout << "Enter a number: "; - cin >> n; - - for (int i = 1; i <= n; i++) { - cout << i << " "; - } - cout << endl; - - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_002.md b/docs/semester_2/practice/prac_002.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_002.cpp' -description: 'design a class circle.take radius as input, calculate the area' -source: 'semester_2/practice/prac_002.cpp' ---- - -# prac_002.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -design a class circle.take radius as input, calculate the area -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_002.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_002.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_002.cpp] -#include <iostream> -using namespace std; - -class circle { - int radius, area; - -public: - int input(); - int calculation(); - int output(); -}; - -int circle::input() { - cout << "\nEnter the radius of the circle : "; - cin >> radius; -} - -int circle::calculation() { - area = 3.14159 * radius * radius; -} - -int circle::output() { - cout << "\nThe area of the circle is : " << area; -} - -int main() { - circle z; - z.input(); - z.calculation(); - z.output(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_003.md b/docs/semester_2/practice/prac_003.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_003.cpp' -description: 'Addition of two inputs' -source: 'semester_2/practice/prac_003.cpp' ---- - -# prac_003.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Addition of two inputs -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_003.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_003.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_003.cpp] -#include <iostream> -using namespace std; - -class addoftwoinput { - int inp1, inp2, out; - -public: - void input(); - void calculation(); - void output(); -}; - -void addoftwoinput ::input() { - cout << "\nInsert the 1st number : "; - cin >> inp1; - cout << "\nInsert the 2nd number : "; - cin >> inp2; -} - -void addoftwoinput ::calculation() { - out = inp1 + inp2; -} - -void addoftwoinput ::output() { - cout << "\nSum of " << inp1 << " and " << inp2 << " is : " << out; -} - -int main() { - addoftwoinput z; - z.input(); - z.calculation(); - z.output(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_004.md b/docs/semester_2/practice/prac_004.md @@ -1,78 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_004.cpp' -description: 'check even or odd' -source: 'semester_2/practice/prac_004.cpp' ---- - -# prac_004.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -check even or odd -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_004.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_004.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_004.cpp] -#include <iostream> -using namespace std; -class ooe { - int n; - -public: - void input(); - void calcdisp(); -}; - -void ooe::input() { - cout << "Enter the number : "; - cin >> n; -} - -void ooe::calcdisp() { - if (n == 0) { - cout << "0 neither a odd or a even number."; - } - else if (n % 2 == 0) { - cout << n << " is a even number."; - } - else { - cout << n << " is a odd number."; - } -} - -int main() { - ooe a; - a.input(); - a.calcdisp(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_005.md b/docs/semester_2/practice/prac_005.md @@ -1,82 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_005.cpp' -description: 'check prime or not' -source: 'semester_2/practice/prac_005.cpp' ---- - -# prac_005.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -check prime or not -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_005.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_005.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_005.cpp] -#include <iostream> -using namespace std; - -class ponp { - int input, i; - -public: - void getinput(); - void calcdisp(); -}; - -void ponp::getinput() { - cout << "please enter the value : "; - cin >> input; -} - -void ponp::calcdisp() { - if (input <= 1) { - cout << "This is not a prime number."; - return; - } - - for (i = 2; i <= input / 2; i++) { - if (input % i == 0) { - cout << "this is not a prime number."; - return; - } - } - cout << "prime"; -} - -int main() { - ponp z; - z.getinput(); - z.calcdisp(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_006.md b/docs/semester_2/practice/prac_006.md @@ -1,80 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_006.cpp' -description: 'factorial' -source: 'semester_2/practice/prac_006.cpp' ---- - -# prac_006.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -factorial -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_006.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_006.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_006.cpp] -#include <iostream> -using namespace std; - -class fact { - int inp, a, i; - -public: - void input(); - void calc(); - void diplay(); -}; - -void fact::input() { - cout << "enter the number :"; - cin >> inp; - a = inp; -} - -void fact::calc() { - for (i = 1; i <= inp - 1; i++) { - a = a * i; - } -} - -void fact::diplay() { - cout << "Factorial " << a << "."; -} - -int main() { - fact z; - z.input(); - z.calc(); - z.diplay(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_007.md b/docs/semester_2/practice/prac_007.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_007.cpp' -description: 'sum of natural numbers upto n' -source: 'semester_2/practice/prac_007.cpp' ---- - -# prac_007.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -sum of natural numbers upto n -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_007.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_007.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_007.cpp] -#include <iostream> -using namespace std; - -class add { - int inp, i, a = 0; - -public: - void input(); - void calc(); - void output(); -}; - -void add::input() { - cout << "enter the number : "; - cin >> inp; -} - -void add::calc() { - for (i = 1; i <= inp; i++) { - a = a + i; - } -} - -void add::output() { - cout << "Addtion = " << a; -} - -int main() { - add z; - z.input(); - z.calc(); - z.output(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_008.md b/docs/semester_2/practice/prac_008.md @@ -1,77 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_008.cpp' -description: 'number reverse' -source: 'semester_2/practice/prac_008.cpp' ---- - -# prac_008.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -number reverse -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_008.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_008.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_008.cpp] -#include <iostream> -using namespace std; - -class rev { - int inp, a = 0, b = 0; - -public: - void input(); - void calc(); -}; - -void rev::input() { - cout << "enter the number to reverse : "; - cin >> inp; - a = inp; -} - -void rev::calc() { - while (inp != 0) { - a = inp % 10; - b = b * 10 + a; - inp = inp / 10; - } - cout << b; -} - -int main() { - rev z; - z.input(); - z.calc(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_009.md b/docs/semester_2/practice/prac_009.md @@ -1,81 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_009.cpp' -description: 'sum of digits' -source: 'semester_2/practice/prac_009.cpp' ---- - -# prac_009.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -sum of digits -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_009.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_009.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_009.cpp] -#include <iostream> -using namespace std; - -class digitsum { - int inp, a = 0, b = 0; - -public: - void input(); - void calc(); - void output(); -}; - -void digitsum::input() { - cout << "enter the number :"; - cin >> inp; -} - -void digitsum::calc() { - while (inp > 0) { - a = inp % 10; - b = b + a; - inp = inp / 10; - } -} - -void digitsum::output() { - cout << "sum of the digits : " << b << "."; -} - -int main() { - digitsum z; - z.input(); - z.calc(); - z.output(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_010.md b/docs/semester_2/practice/prac_010.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_010.cpp' -description: 'check odd or even' -source: 'semester_2/practice/prac_010.cpp' ---- - -# prac_010.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -check odd or even -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_010.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_010.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_010.cpp] -#include <iostream> -using namespace std; - -class ooe { - int n; - -public: - void input(); - void calcdisp(); -}; - -void ooe::input() { - cout << "Enter the number : "; - cin >> n; -} - -void ooe::calcdisp() { - if (n == 0) { - cout << "0 is neither an odd nor an even number."; - } - else if (n % 2 == 0) { - cout << n << " is a even number."; - } - else { - cout << n << " is a odd number."; - } -} - -int main() { - ooe a; - a.input(); - a.calcdisp(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_011.md b/docs/semester_2/practice/prac_011.md @@ -1,93 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_011.cpp' -description: 'average of elements' -source: 'semester_2/practice/prac_011.cpp' ---- - -# prac_011.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -average of elements -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_011.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_011.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_011.cpp] -#include <iostream> -using namespace std; - -class avarage { - int inp[100], sum = 0, n, i; - float avg; - -public: - void input(); - void calculation(); - void output(); -}; - -void avarage::input() { - cout << "\nEnter the number of elements : "; - cin >> n; - i = 0; - while (i < n) { - cout << "\nEnter the element no " << i + 1 << " : "; - cin >> inp[i]; - i++; - } -} - -void avarage::calculation() { - i = 0; - for (i = 0; i < n; i++) { - sum = sum + inp[i]; - } - avg = (float)sum / n; -} - -void avarage::output() { - i = 0; - cout << "\nAvarage of the element "; - for (i = 0; i < n; i++) { - cout << " " << inp[i]; - } - cout << " is : " << avg; -} - -int main() { - avarage z; - z.input(); - z.calculation(); - z.output(); - return 0; -} -``` diff --git a/docs/semester_2/practice/prac_012.md b/docs/semester_2/practice/prac_012.md @@ -1,79 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> prac_012.cpp' -description: 'factorial using loop' -source: 'semester_2/practice/prac_012.cpp' ---- - -# prac_012.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 22 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -factorial using loop -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/practice/prac_012.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/practice/prac_012.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [prac_012.cpp] -#include <iostream> -using namespace std; - -class fact { - int inp, a = 1, i; - -public: - void input(); - void calc(); - void output(); -}; - -void fact::input() { - cout << "enter the number :"; - cin >> inp; -} - -void fact::calc() { - for (i = 1; i <= inp; i++) { - a = a * i; - } -} - -void fact::output() { - cout << "factorial : " << a; -} - -int main() { - fact z; - z.input(); - z.calc(); - z.output(); - return 0; -} -``` diff --git a/docs/semester_2/python/code_01.md b/docs/semester_2/python/code_01.md @@ -1,64 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> code_01.py' -description: 'Coming back to basics after months.' -source: 'semester_2/python/code_01.py' ---- - -# code_01.py - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 18 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Coming back to basics after months. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/python/code_01.py" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/python/code_01.py" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```python [code_01.py] -# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 18 Jun 2026 -# Repo: https://github.com/notamitgamer/bsc -# License: MIT - -# Coming back to basics after months. - -n = int(input("How many numbers? ")) -even_count = 0 -odd_count = 0 - -for i in range(n): - num = int(input("Enter a number: ")) - if num % 2 == 0: - even_count += 1 - else: - odd_count += 1 - -print("Even numbers:", even_count) -print("Odd numbers:", odd_count) -``` diff --git a/docs/semester_2/python/index.md b/docs/semester_2/python/index.md @@ -1,10 +0,0 @@ -# Python - -Files and sub-folders in **Python**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `code_01.py` | [View Code](code_01.md) | - diff --git a/docs/semester_2/tuition/apc_001.md b/docs/semester_2/tuition/apc_001.md @@ -1,61 +0,0 @@ ---- -title: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline; margin-bottom:-2px; margin-right:6px;"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"/><path d="M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"/></svg> apc_001.cpp' -description: 'Tring to remember after a year.' -source: 'semester_2/tuition/apc_001.cpp' ---- - -# apc_001.cpp - -### Metadata - -- **Author** — Amit Dutta (amitdutta4255@gmail.com) -- **Last updated** — 18 Jun 2026 -- **License** — [MIT](https://github.com/notamitgamer/bsc/blob/main/LICENSE) - - -### Problem Statement - -::: tip Problem Statement -Tring to remember after a year. -::: - -## Source Code - -<div style="display:flex;gap:12px;margin-bottom:12px;"> - <a href="https://github.com/notamitgamer/bsc/blob/main/semester_2/tuition/apc_001.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-brand);"> - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:middle;"> - <path d="M12 0C5.37 0 0 5.373 0 12c0 5.303 3.438 9.8 8.205 11.387.6.113.82-.258 .82-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.757 -1.333-1.757-1.089-.745.083-.729.083-.729 1.205.084 1.84 1.236 1.84 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3 -5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523 .105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873 .12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92 .42.36.81 1.096.81 2.22v3.293c0 .319.21.694.825.576C20.565 21.795 24 17.298 24 12c0-6.627-5.373-12-12-12z"/> - </svg> - View on GitHub - </a> - <a href="https://raw.usercontent.amit.is-a.dev/semester_2/tuition/apc_001.cpp" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:6px;font-size:0.85rem; text-decoration:none;color:var(--vp-c-text-2);"> - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;"> - <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/> - <polyline points="7 10 12 15 17 10"/> - <line x1="12" y1="15" x2="12" y2="3"/> - </svg> - Download Raw - </a> -</div> - -::: info Printing the code -To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page. -::: -```cpp [apc_001.cpp] -#include <iostream> -using namespace std; - -int main() { - int num, count = 0; - cout << "Enter numbers one by one (enter -1 to stop):" << endl; - - cin >> num; - while (num != -1) { - count++; - cin >> num; - } - - cout << "Total numbers entered: " << count << endl; - return 0; -} -``` diff --git a/docs/semester_2/tuition/index.md b/docs/semester_2/tuition/index.md @@ -1,10 +0,0 @@ -# Tuition - -Files and sub-folders in **Tuition**. - -## Files - -| # | File | Link | -|---|---|---| -| 1 | `apc_001.cpp` | [View Code](apc_001.md) | -