diff --git a/R Programming b/R Programming new file mode 100644 index 00000000000..55476b60f62 --- /dev/null +++ b/R Programming @@ -0,0 +1,19 @@ +makeCacheMatrix <- function() { +mat <- NULL +inv_cache <- NULL +setMatrix <-function(x){ +mat <<-x +inv_cache<<- NULL +} +getInverse <- function() { +if (is.null(inv_cache)){ +inv_cache <<-solve(mat) +} +inv_cache +} +list(setMatrix=setMatrix,getInverse = getInverse) +} +cacheSolve <- function(x,...){ +inv_cache <-x$getInverse() +inv_cache +}