Computer Science, asked by papazora, 1 year ago

print 1,-3,5,-7,9 in bluej

Answers

Answered by amira93
2
Import java.util.Scanner;
public class Series
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

System.out.print("Enter the value of n: ");
int n = sc.nextInt();
int k=-1;

for(int i=1;i<=n;i+=2)
{
k *= -1;
System.out.print((k*i)+" ");
}
}
}

amira93: mark as brainlist plz
amira93: plzzzzz
papazora: it us vrainliwst
amira93: what ? it is brainlist
papazora: yes
amira93: ok
amira93: then mark me as brainlist please
Similar questions