(Java)
Create a program –using a loop -that will display the series of numbers:
1 -2 3 -4 5 -6 7 -8 9 -10
Answers
Answered by
2
Answer:
class series
{
public static void main(String args[])
{
for( int i=1; i<=10; i++)
{
if( i%2==0)
System.out.print( "-" + i + " ");
else
System.out.print( i + " ");
}
}
}
Similar questions