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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:13:56+00:00 2026-05-23T16:13:56+00:00

I am working on solving a mathematical problem. What I am trying to do

  • 0

I am working on solving a mathematical problem.
What I am trying to do is to have an if statement that compares variable n to a set of variables i 1 through 10. Is there any way to do it in c++?
here is what I am trying to do:

 int smallPos(int n){
     if (n%for(int i=1;i<=10;i++)==0) {
        return n;
      }

This is obviously wrong but is any way to get around it?

  • 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-23T16:13:57+00:00Added an answer on May 23, 2026 at 4:13 pm

    What you want to do is this:

    int smallPos(int n)
    {
        for (int i = 1; i <= 10; ++i)
        {
            if (n % i != 0) // check if n % i == 0, if not, then we shouldn't return n.
            { 
                return -1; // or whatever you want to return when not ALL the remainders are 0.
            }
        }
    
        return n; // If we get here then all the remainders were 0s.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a program for class that involves solving the Chinese Postman problem
Summary: How would I go about solving this problem? Hi there, I'm working on
Ok, I have been working on solving this problem all day, and I am
Working on a problem that requires a GA. I have all of that working
I have been working on this site, http://hidden.xx The problem is that the <body>
I am working to solve a problem that is a bit similar to Euler
I'm working at a SaaS, where any tenant can have several lists of contacts,
I'm currently working on a project Euler problem (www.projecteuler.net) for fun but have hit
I am working on a solution that aims at solving problems that newbie programmers
I was working with a program that uses a function to set a new

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.