vec1<-c(23,45,68,46,89,57,90,36)
vec2<-c(24,54,67,86,90,23,100,11)
vec3<-c(21,45,81,30,24,45,67,45)
vec1<-((vec1-min(vec1))/(max(vec1)-min(vec1)))
vec2<-((vec2-min(vec2))/(max(vec2)-min(vec2)))
vec3<-((vec3-min(vec3))/(max(vec3)-min(vec3)))
vec1
vec2
vec3
rescale<-function(vec){
vec<-((vec-min(vec))/(max(vec)-min(vec)))
return (vec)
}
rescale(vec1)
vec1<-c(23,45,68,46,89,57,90,36)
reciprocal<-function(vec)vec<-1/vec
rvec1<-reciprocal(vec1)
rvec1
factorial<-function(x){
if(x==0)
return (1)
else
return (x*factorial (x-1))
}
factorial (5)
check <-function(x){
if(x%%3==0){
result<-"the number is divisible by 3"
}else {
result= "the number is not divisibleb by 3"
return (results)
}
check(106)
To embed this program on your website, copy the following code and paste it into your website's HTML: