Skip to content

Commit 45d3c5c

Browse files
authored
Create R Program
1 parent 7f657dd commit 45d3c5c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

R Program

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
makeCacheMatrix <- function() {
2+
mat <- NULL
3+
inv_cache <- NULL
4+
setMatrix <-function(x){
5+
mat <<-x
6+
inv_cache<<- NULL
7+
}
8+
getInverse <- function() {
9+
if (is.null(inv_cache)){
10+
inv_cache <<-solve(mat)
11+
}
12+
inv_cache
13+
}
14+
list(setMatrix=setMatrix,getInverse = getInverse)
15+
}
16+
cacheSolve <- function(x,...){
17+
inv_cache <-x$getInverse()
18+
inv_cache
19+
}

0 commit comments

Comments
 (0)