lines=readLines("stdin") for(l in lines){ if(l == ""){ break; } ll = strsplit(l, " ")[[1]] a=ll[1]; b=ll[2]; cat(as.numeric(a)+as.numeric(b)); cat('\n'); }