User Tools

Site Tools


day1_exercise4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

day1_exercise4 [2017/12/13 18:14] (current)
hyjeong created
Line 1: Line 1:
 +  x = runif(10) 
 +   
 +  #1 
 +  if(sum(x)>​5) { 
 +    cat('​sum(x) is greater than 5.\n'​) 
 +  } else if(sum(x)<​5) { 
 +    cat('​sum(x) is less than 5.\n'​) 
 +  } else 
 +    cat('​sum(x) is equal to 5.\n'​) 
 +   
 +  #2 
 +  y = ifelse(x<​0.5,​x,​x-0.5) 
 +   
 +  #3 
 +  i=3 
 +  switch(i,​x+y,​x-y,​x*y)
day1_exercise4.txt · Last modified: 2017/12/13 18:14 by hyjeong