Question: We shall take some numbers like 1 to 10, From the mentioned numbers we shall print the odd numbers except 3 and 5 and at last also we shall make SUM of those odd number .

#### 1 thought on “JavaScript Problem-01”

### Leave a Reply

You must be logged in to post a comment.

Answer is:

var startingNumber;

var endingNumber;

var oddNumbers;

var sum=0;

function calculateSum(startingNumber, endingNumber){

//First Start loop for 1 to 10

for(startingNumber; startingNumber< =endingNumber; startingNumber++){ //Sort odd numbers from 1 to 10 numbers if(startingNumber%2!=0){ //skip 3 if(startingNumber==3) continue; //skip 5 if(startingNumber==5) continue; //Sum of odd numbers except 3 and 5 from 1 to 10 document.writeln("Odd number: "+startingNumber+"

“);

sum+=startingNumber;

}

}

document.writeln(“SUM of Odd Numbers: “+sum);

}

calculateSum(1,10);