> 
> I don't understand. -- 
> 
> 7%%2=1
> 9%%2=1
> 11%%2=1
> 
> What aren't these numbers printing ? 
> 
> num<-0
> for (i in 1:100){
>  num<-num+i
> if (num%%2 != 0) 
>  print(num)
> }

Your code tests the numbers

        1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, …

and correctly prints the odd ones among them.

But I suppose that's not what you wanted to do?

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to