Computer Science, asked by sunitagupta54637, 1 year ago

Write a JavaScript code to print all the odd numbers from 15 backwards to 3.

Answers

Answered by Anonymous
0

import java.util.*;

public class Series

{

public static void main(String args[])

{

int a;

for(a=15;a>=3;a=a-2)

{

System.out.println("Display the series"+a);

}

}

}

.......................................................................................................................

//The program terminates several times so we should use loop here.

//We have to print the series in a backward manner so we should gradually decrease the value of a.

//For decreasing the value of a, instead of taking number of variables and writing again and again we should use java iteration such as a- -.

//Here we should use, a=a-2, because the previous odd number we get subtracting 2 from that number.

//We should avoid using scanner class here because there is no such case of taking input of the value of any variable in this program.

//For most probably similar content follow the suggested link too as i answered earlier:

https://brainly.in/question/14323927

Similar questions