कंप्यूटर प्रोग्रामिंग/वेरिएबल/आर
hello.r
सम्पादनprint("Variables and Data Types", quote = FALSE)
i <- 12345
n <- 1.23456789012345
s <- "string"
print(paste("number:", i), quote = FALSE)
print(paste("number:", n), quote = FALSE)
print(paste("string: ", s), quote = FALSE)
print("", quote = FALSE)
print("Constants", quote = FALSE)
print("R doesn't support constants.", quote = FALSE)
print("", quote = FALSE)
print("Arithmetic Operators", quote = FALSE)
a <- 3
b <- 2
print(paste("a =", a), quote = FALSE)
print(paste("b =", b), quote = FALSE)
print(paste("a + b =", a + b), quote = FALSE)
print(paste("a - b =", a - b), quote = FALSE)
print(paste("a * b =", a * b), quote = FALSE)
print(paste("a / b =", a / b), quote = FALSE)
print("", quote = FALSE)
print("Assignment Operators", quote = FALSE)
a <- a + b
print(paste("a <- a + b is", a), quote = FALSE)
a <- a - b
print(paste("a <- a - b is", a), quote = FALSE)
a <- a * b
print(paste("a <- a * b is", a), quote = FALSE)
a <- a / b
print(paste("a <- a / b is", a), quote = FALSE)
print("", quote = FALSE)
print("String Concatenation", quote = FALSE)
s1 = "Hello"
s2 = "world"
print(paste(s1, " ", s2, "!", sep = ""), quote = FALSE)
print("", quote = FALSE)
print("User Input", quote = FALSE)
print("What is your name?", quote = FALSE)
name <- readLines("stdin", 1)
print(paste("Hello ", name, "!", sep = ""), quote = FALSE)
कोशिश करो
सम्पादननिम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।