Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 239237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:34:09+00:00 2026-05-11T20:34:09+00:00

This is probably a silly and easy question, but it seems sometimes the simplest

  • 0

This is probably a silly and easy question, but it seems sometimes the simplest things give me more problems!

This formula is suppose to give me a number between 0 and 100.

(200 / 23) * Abs(Mod(2987, 23) - 23 / 2)

In objective C I coded it like this:

(200 / 23) * abs(2987 % 23) - (23 / 2);

Is the formula flawed (and doesn’t give an answer between 0 and 100) or is my code wrong? It seems that my modulus isn’t giving me the right result. Shouldn’t it give me a one number integer?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:34:10+00:00Added an answer on May 11, 2026 at 8:34 pm

    Your code is wrong in objective C…

    (200 / 23) * abs(2987 % 23) - (23 / 2);
    

    Should be

    (200 / 23) * abs((2987 % 23) - (23 / 2));
    

    Which is just 73.9.

    But this formula is also incorrect, you want values between 0 and 100. Your current formula does not reach 0, because a%23 has a range of 0-22, so the lowest value you can get if you subtract 23/2 and then take the absolute value is .5 (11-11.5 and 12-11.5). 22 would be the ideal number in this instance.

    Also by subtracting 23/2 you get an uneven distribution, if you just multiplied the mod by 100/22, you would be better off. It would help to know what you are attempting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a silly question, but curiosity has gotten the better of me.
This is probably a really simple jQuery question, but I couldn't answer it after
This is probably a really stupid newbie-sounding question to you developer type people, but
Probably a silly question but I cannot find a way to do it. I
This is probably silly but very frustrating. Using VS2008 with a C++ project, when
This is probably silly but I don't have enough Elisp knowledge to understand what
This is probably a silly question. I am experimenting with python doctest, and I
This is probably a silly error, but it's driving me nuts trying to fix
This may be a silly question with an obvious answer, but I've pondered it
This probably has a simple answer, but I must not have had enough coffee

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.