Programs1TO3
Programs1TO3
Program :
# Program to demonstrate basic data types in R
# Numeric (double)
print(paste("Numeric:", num_value))
print(typeof(num_value))
# Integer
int_value <- as.integer(10)
print(paste("Integer:", int_value))
print(typeof(int_value))
# Character (String)
char_value <- "Hello, R!"
print(paste("Character:", char_value))
print(typeof(char_value))
# Logical (Boolean)
# Complex Number
complex_value <- 3 + 2i
print(paste("Complex:", complex_value))
print(typeof(complex_value))
print(typeof(raw_value))
Output:
Result:
You have to get inputs for the array from the users for matrix dimension and matrix values in the
following programs:
Program2;
if (arr[mid] == target) {
}
# Example Usage
arr <- c(2, 5, 8, 12, 16, 23, 38, 45, 56, 72) # Sorted array
target <- 23
# Display Result
if (result != -1) {
Output:
Result:
Program3:
# Matrix Addition
# Display Result
print(matrix_addition)
# Matrix Multiplication
# Display Result
Output:
Result: