JavaScript Problem-01

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 .

One thought on “JavaScript Problem-01

  • Rajaul Islam
    June 22, 2017 at 11:43 am

    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+"
    document.writeln(“SUM of Odd Numbers: “+sum);

Leave a Reply