Big_Data_Slip_1

Slip No.1

1) Write an R program to find the maximum and the minimum value of a given vector.

    # Define the vector
    vector <- c(12, 45, 3, 67, 23, 89, 5)

    # Find the maximum value
    max_value <- max(vector)

    # Find the minimum value
    min_value <- min(vector)

    # Print the results
    cat("The maximum value in the vector is:", max_value, "\n")
    cat("The minimum value in the vector is:", min_value, "\n")

No comments:

Post a Comment