Create a sequence of even numbers between 1 to 10, iterating the sequence twice. This needs to be written in R
Answers
Answered by
1
To solve the question in java we have to do the following:-
for ( int j = 1 ; j < = 2 ; j + +)
for( int i = 0 ; i < = 10 ; i = i + 2 )
{
R = i ;
System . out . println ( R + " " ) ;
}
Here the initial value of the control variable j set to 1 which shall execute twice and the inner loop contains the printing sequence of even numbers.
Answered by
26
In R :-
a<-rep(c(2,4,6,8,10), times=2)
a
Similar questions