View the step-by-step solution to:

explain this function :

explain this function : given that the sin is 123 567 989


checkNum = sin % 10;

   

    int count = 4;

    int evenTotal = 0;

    int oddTotal = 0;

    int eModNum = 100;

    int oModNum = 1000;

    int eDivNum = 10;

    int oDivNum = 100;

    int evenSum, oddSum;

    int total, totalTen, diff;

   

    for(int i = 0; i < count; i++){

      evenSum = (sin % eModNum / eDivNum) * 2;

      oddSum = sin % oModNum / oDivNum;

      if(evenSum >= 10){

        evenTotal += (evenSum % 10) + (evenSum % 100 / 10);

      } else {

        evenTotal += evenSum;

      }

   

      oddTotal += oddSum;

      eModNum *= 100;

      eDivNum *= 100;

      oModNum *= 100;

      oDivNum *= 100;

   

    }

   

    total = evenTotal + oddTotal;

    

    totalTen = total;

    while (totalTen % 10 != 0){

      totalTen++;

    }

    diff = totalTen - total;

    if(diff == checkNum){

      valid = true;

    } else {

      valid = false;

    }

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question