bsc

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

commit 5c0e85bd791bee3dc369c0042c024ad59291a158
parent babcbd8be1d4b12fa3bcc52a3153ee64d92e2dbf
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Wed, 25 Mar 2026 21:35:58 +0530

[2026-03-25] : .\Semester_1\R\Code : added practice code

Diffstat:
ASemester_1/R/Code/R_Code-15.r | 9+++++++++
ASemester_1/R/Code/R_Prac-1.r | 14++++++++++++++
ASemester_1/R/Code/R_Prac-2.r | 10++++++++++
ASemester_1/R/Code/R_Prac-3.r | 11+++++++++++
ASemester_1/R/Code/R_Prac-4.r | 13+++++++++++++
ASemester_1/R/Code/R_Prac-5.r | 16++++++++++++++++
ASemester_1/R/Code/R_Prac-6.r | 25+++++++++++++++++++++++++
Mdocs/index.html | 214+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
8 files changed, 303 insertions(+), 9 deletions(-)

diff --git a/Semester_1/R/Code/R_Code-15.r b/Semester_1/R/Code/R_Code-15.r @@ -0,0 +1,8 @@ +# 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."))+ \ No newline at end of file diff --git a/Semester_1/R/Code/R_Prac-1.r b/Semester_1/R/Code/R_Prac-1.r @@ -0,0 +1,13 @@ +# 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)+ \ No newline at end of file diff --git a/Semester_1/R/Code/R_Prac-2.r b/Semester_1/R/Code/R_Prac-2.r @@ -0,0 +1,9 @@ +# 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."))+ \ No newline at end of file diff --git a/Semester_1/R/Code/R_Prac-3.r b/Semester_1/R/Code/R_Prac-3.r @@ -0,0 +1,10 @@ +# 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) +}+ \ No newline at end of file diff --git a/Semester_1/R/Code/R_Prac-4.r b/Semester_1/R/Code/R_Prac-4.r @@ -0,0 +1,12 @@ +# 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))+ \ No newline at end of file diff --git a/Semester_1/R/Code/R_Prac-5.r b/Semester_1/R/Code/R_Prac-5.r @@ -0,0 +1,15 @@ +# 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))+ \ No newline at end of file diff --git a/Semester_1/R/Code/R_Prac-6.r b/Semester_1/R/Code/R_Prac-6.r @@ -0,0 +1,24 @@ +# 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)))+ \ No newline at end of file diff --git a/docs/index.html b/docs/index.html @@ -1012,6 +1012,29 @@ if(temperature &gt; 30) { </div> <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Code-15-r', 'R_Code-15.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Code-15.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Code-15.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Code-15.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Code-15-r" style="display:none;"># Asking for a name +name &lt;- readline(prompt = &quot;Enter your name: &quot;) + +# Asking for a number (requires conversion) +age &lt;- readline(prompt = &quot;Enter your age: &quot;) +age &lt;- as.numeric(age) + +print(paste(&quot;Hello&quot;, name, &quot;you are&quot;, age, &quot;years old.&quot;))</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Code-2-r', 'R_Code-2.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Code-2.r')"> <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> @@ -1036,6 +1059,31 @@ print(class(num))</div> </div> <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Code-3-r', 'R_Code-3.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Code-3.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Code-3.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Code-3.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Code-3-r" style="display:none;"># Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 +# Repo: https://github.com/notamitgamer/bsc +# License: MIT + +# Assume you have a variable company &lt;- &quot;Programiz&quot;. +# Write a line of code using the paste0() function to print &quot;Welcome toProgramiz&quot; +# ensuring there is no default space between the string and the variable. + +company &lt;- &quot;Programiz&quot; +print(paste0(&quot;welcome to&quot;, company))</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Code-4-r', 'R_Code-4.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Code-4.r')"> <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> @@ -1209,28 +1257,176 @@ print(power(&quot;b&quot; = b))</div> </div> <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> - <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_code-3-r', 'R_code-3.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_code-3.r')"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Prac-1-r', 'R_Prac-1.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-1.r')"> <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> </svg> - <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_code-3.r</span> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Prac-1.r</span> </div> <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> - <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_code-3.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-1.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> </a> </div> <!-- Embedded Code Storage --> - <div id="code-Semester_1-R-Code-R_code-3-r" style="display:none;"># Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 + <div id="code-Semester_1-R-Code-R_Prac-1-r" style="display:none;"># Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 25 Mar 2026 # Repo: https://github.com/notamitgamer/bsc # License: MIT -# Assume you have a variable company &lt;- &quot;Programiz&quot;. -# Write a line of code using the paste0() function to print &quot;Welcome toProgramiz&quot; -# ensuring there is no default space between the string and the variable. +# Write a R program to print numbers from 1 to 5. -company &lt;- &quot;Programiz&quot; -print(paste0(&quot;welcome to&quot;, company))</div> +i = 1 +while(i &lt;= 5) { + print(i) + i = i + 1 +} +# or we can use +print(1:5)</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Prac-2-r', 'R_Prac-2.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-2.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Prac-2.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-2.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Prac-2-r" style="display:none;"># 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 &lt;- readline(prompt=&quot;Enter the number: &quot;) +num &lt;- as.integer(num) +print(paste(num, &quot;is&quot;, ifelse(num %% 2 == 0, &quot;EVEN&quot;, &quot;ODD&quot;), &quot;number.&quot;))</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Prac-3-r', 'R_Prac-3.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-3.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Prac-3.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-3.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Prac-3-r" style="display:none;"># 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 &lt;- c(1:6) +for(elem in sample) { + print(elem) +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Prac-4-r', 'R_Prac-4.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-4.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Prac-4.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-4.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Prac-4-r" style="display:none;"># 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 &lt;- as.double(readline(prompt=&quot;Enter 1st number: &quot;)) +num2 &lt;- as.double(readline(prompt=&quot;Enter 2nd number: &quot;)) +if(is.na(num1) || is.na(num2)) { + stop(&quot;You did not enter a valid number.&quot;) +} +print(paste(&quot;Result&quot;, num1 + num2))</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Prac-5-r', 'R_Prac-5.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-5.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Prac-5.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-5.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Prac-5-r" style="display:none;"># 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(&quot;Enter your numbers: &quot;) +nums &lt;- as.integer(scan()) +count = 0 +for(i in nums) { + if(i %% 2 == 0) { + count = count + 1 + } +} +print(paste(&quot;Even Count=&quot;, count))</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-R-Code-R_Prac-6-r', 'R_Prac-6.r', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-6.r')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">R_Prac-6.r</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/R/Code/R_Prac-6.r" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-R-Code-R_Prac-6-r" style="display:none;"># 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 &lt;- list(&quot;Amit&quot;, 19, &quot;Madhyamgram&quot;, 94.5) +print(&quot;Initial list:&quot;) +print(l) + +l[[4]] = 95.46 +print(&quot;after modifing last element: &quot;) +print(l) + +l[length(l) + 1] &lt;- &quot;hello&quot; +print(&quot;after adding new element:&quot;) +print(l) + +l[3] &lt;- NULL +print(&quot;after deleting a element: &quot;) +print(l) + +print(paste(&quot;length of the list after modifing:&quot;, length(l)))</div> </div> </div>
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror