I am getting the output for below program as "Inf" when i am giving y=0. i was expecting "y value should not be zero". how to correct it.
myfunc<-function(){ a=as.numeric(readline(prompt="Enter the value of x:")) b=as.numeric(readline(prompt="Enter the value of y:")) if(b=0){print("y value should not be zero")} else{print(a/b)} } myfunc()
myfunc<-function(){
a=as.numeric(readline(prompt="Enter the value of x:"))
b=as.numeric(readline(prompt="Enter the value of y:"))
if(b==0){
print("y value should not be zero")
} else {print(a/b)}
}