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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:19:34+00:00 2026-06-11T23:19:34+00:00

So in my app I am trying to do a simple math in one

  • 0

So in my app I am trying to do a simple math in one of my methods without using a ton of if/else statements.

So I have an integer named ‘StartInt’ which is at max 13. Now what I need to get is FinishInt an integer that will be the result of this pattern:

StartInt: 13 FinishInt: 1  
StartInt: 12 FinishInt: 2 
StartInt: 11 FinishInt: 3

etc… all the way down until StartInt is 1 and FinishInt is 13. Anyway how would I accomplish this? I know this must be simple but I am just not that great in Math! 🙂

  • 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-06-11T23:19:36+00:00Added an answer on June 11, 2026 at 11:19 pm

    All the way down until StartInt is 0 and FinishInt is 13. Anyway how
    would I accomplish this?

    That won’t quite work if startInt = 13 gives finishInt = 1 and you want a finishInt to increment 1 for each decrement of startInt. Check out the following table:

    13   1
    12   2
    11   3
    10   4
     9   5
     8   6
     7   7
     6   8
     5   9
     4  10
     3  11
     2  12
     1  13
    

    So you’re off by 1 at either the beginning or end of your sequence. Nevertheless, it looks like you want something like this:

    (int) calculateFinish(int startInt)
    {
        int finishInt = -1;
        if (startInt >= 0 && startInt <= 13) {
            finishInt = 14 - startInt;
        }
        return finishInt;
    }
    

    That’d give a value of 14 for finishInt when startInt = 0.

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

Sidebar

Related Questions

Im trying to create a simple pan and zoom app using silverlight 4, but
I'm trying to save simple text data in my app using this code from
I am trying to make simple app that allows one to compare image to
All - Trying to do 2 things: I have a simple app and am
Hello I am trying run a simple test in a web app using Play!
I'm trying to pull an integer out of localStorage with a simple clojurescript app.
Good times! My Android app is trying to read simple text file, using usual
I have a simple (tested) pycuda app and am trying to profile it. I've
I have been trying to generate simple PDFs from my app so that I
I've been trying create this simple ish to-do list web app using JavaScript &

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.