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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:16:15+00:00 2026-05-29T05:16:15+00:00

we did this problem today in math class to kill time after a quiz,

  • 0

we did this problem today in math class to kill time after a quiz, and i was wondering if i could make a program along these lines

so the idea is this:
take the number 123,456,789
the first digit from the left is divisible by 1, good, continue
the first 2 digits from the left are divisible by 2, good, continue
the first 3 digits from the left are divisible by 3, good, continue
the first 4 digits from the left are NOT divisible by 4, you get a remainder, bad, restart with different numbers, or go back until one of the numbers can be replaced (the even spaces are pretty interchangeable)
the tricky part here is that you cant use the same integer twice
the only place we can be sure about is the fifth place, so we can tell that the number will look something like: _ _ _, _ 5 _, _ _ _

i want the program to print the number(s) which is(are) perfectly divisible, all the way to the ones place. im pretty sure that only one number fits this criteria, but id like to know if this is true, which is why im trying to make this program.

what i need help with is how i should go about checking if each number divided by its place has no remainder, and how to go back if it doesnt fit.

pretty new to coding..anything helps

  • 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-29T05:16:16+00:00Added an answer on May 29, 2026 at 5:16 am

    You could setup a loop, that uses the modulus operator (%) to get the remainder of a number. I would setup an array with a legnth of 10, and modulus the number by 10 and put the result into the array (because you will read the numbers in reverse you need to place them into the array in reverse), until you have each digit.

    I would then setup an int (named maybe value), and put the first value in the array, into this int. I would also designate another int (named maybe place) and set it equal to 1. Define a bool (named maybe flag).

    I would then enter a loop so that you have the equation if(value % place == 0) flag = 0.
    Then have the loop break if flag == 1, and goto a label before the loop, where you have an algorithm that generates a new number (maybe somthing as simple as adding one, or what ever you want). Also inside the loop if place == 10 and your last value in the number is 0, you need to print the number, and then jump to your label from earlier, before the loop, to pick a new number. Also don’t forget that if flag == 0, and place != 10 (the number hasn’t failed yet, but isn’t at the end yet) , that you need to multiply the value by 10 , then add the next number in the array to be able to test the next place. And you also need to increase place by 1 each time.

    You said you’re new, so I’ll include a few definations:

    1. ‘=’ sets a variable equal to somthing, ‘==’ is used to test equality
    2. ‘!=’ means “not equal to”. It’s also used to test variables against other variables or numbers.
    3. ‘%’ or modulus divides two numbers but rather returns the remainder (ex. 10 % 3 = 1, because 10 / 3 = 9 remainder 1)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did a math problem today and first attempted it in Python but after
[Note: There is another thread about this problem but it did not answer the
Sorry since this question is specific to my problem. While learning reflections i did
Today's problem in my code is kind of strange, and I could not reproduce
I am actually using this calendar source code, but I did encountered a problem
I did this tests and the results seems the count function scale linearly. I
I did this in the past, and can't remember the correct command (I think
i did this in msvc 2005. typedef void (*cleanup_t)(); void func(cleanup_t clean) { cleanup_t();
i did this: this.combobox.ItemsSource = Common.Component.ModuleManager.Instance.Modules; to bind the combobox to a collection, which
I did this: [User.first, User.last].to_xml and got this: <users type=array> <user> <created-at type=datetime>2010-03-16T06:40:51Z</created-at> <id

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.