This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| v <- c(7,12,28,3,41) | |
| t <- c(14,7,6,19,3) | |
| plot(v,type = "o",col = "red", xlab = "Month", ylab = "Rainfall (mm)", | |
| main = "Rainfall Chart") | |
| lines(t, type = "o", col = "blue") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Enter two numbers:" | |
| read a | |
| read b | |
| echo "Enter choice:" | |
| echo "1. Addition" | |
| echo "2. Subtraction" | |
| echo "3. Multiplication" | |
| echo "4. Division" | |
| read ch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(plotrix) | |
| x <- c(21, 62, 10,53) | |
| lbl <- c("USA","China","Indonesia","India") | |
| pie3D(x,labels = lbl,explode = 0.1, main = "Pie Chart of Most Populous Countries ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "What is the name of your file?" | |
| read FILE | |
| echo "This file will be created as ${FILE}_file." | |
| touch ${FILE}_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clear | |
| read -p "May I know your name, please? " name | |
| echo "Hello $name, let us be friends!" | |
| echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import turtle | |
| import math | |
| import random | |
| screen = turtle.Screen() | |
| screen.setup(700,600) | |
| screen.title("Testing Mountain Curves") | |
| turtle.hideturtle() | |
| turtle.speed(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| max.temp <- c(22, 27, 26, 24, 23, 26, 28) | |
| barplot(max.temp, | |
| main = "Maximum Temperatures in a Week", | |
| xlab = "Degrees Celsius", | |
| ylab = "Day", | |
| names.arg = c("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"), | |
| col = "red", | |
| horiz = TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| convert_to_binary <- function(n) { | |
| if(n > 1) { | |
| convert_to_binary(as.integer(n/2)) | |
| } | |
| cat(n %% 2) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| recur_factorial <- function(n) { | |
| if(n <= 1) { | |
| return(1) | |
| } else { | |
| return(n * recur_factorial(n-1)) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| year = as.integer(readline(prompt="Enter a year: ")) | |
| if((year %% 4) == 0) { | |
| if((year %% 100) == 0) { | |
| if((year %% 400) == 0) { | |
| print(paste(year,"is a leap year")) | |
| } else { | |
| print(paste(year,"is not a leap year")) | |
| } | |
| } else { | |
| print(paste(year,"is a leap year")) |