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 283545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:22:57+00:00 2026-05-12T05:22:57+00:00

i am looking to put together some logic to look at a particular number

  • 0

i am looking to put together some logic to look at a particular number and based on a simple calulcation tell me what another number is. Example – lets say that i have a string of characters and each 50 characters will increment an integer by 1. so if i have 0 – 49 chars, counter = 1, if i have 50-99 chars, counter = 2, if i have 100 – 149 chars, counter = 3.

i thought i could do this by converting everything to type int but that doesnt work as sometimes it will round down when it should always round up – i.e. (int)(charCount / 50).

Im wondering if i have to use the modulus operator. Any suggestions?

  • 1 1 Answer
  • 3 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-12T05:22:57+00:00Added an answer on May 12, 2026 at 5:22 am

    For this exact example, you can just increment the counter after your division, so:

    int counter = (int)(stringToCheck.Length / 50) + 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to put together some VBA code in access to send out a
Thanks for looking. I'm trying to put together a simple live wallpaper, and trying
I'm looking to put together a simple scriptable backup utility to grab all the
I am looking into a basic DOM layout that lets me put a couple
I'm looking for some assistance with some code. I'm trying to put this to
I am trying to make put together a simple application to control the phone
I have been working with the example code from the ExecutorCompletionService and put together
Ok so Ive spent the last two days looking for a good simple example
I need to put together some coding to enable foreman to find the bricklayer
I've got a small php web app I put together to automate some manual

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.