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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:25:32+00:00 2026-06-04T01:25:32+00:00

I have a problem as stated below: i have an array(say) a[]={10,24,56,33,22,11,21} i have

  • 0

I have a problem as stated below:
i have an array(say) a[]={10,24,56,33,22,11,21}
i have something like this

for(i=0;i<100;i++){
    if(a[i]==10)
        // do something
}

next when i=1

if(a[i]==10 && a[i+1]==24)

so on so at each iteration the arguments / conditions within if should be varying
now this will be a very big sequence i cant explicitly write
if(a[i]==10 && a[i+1]==24 && a[i+2]==56 ...... a[i+100]=2322)

how can i achieve this varying conditions?

  • 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-04T01:25:34+00:00Added an answer on June 4, 2026 at 1:25 am

    You have to have a cumulative “boolean” variable that checks a[i] at the i-th iteration and update that variable:

    int a[] = {...};   /* array with some values to verify */
    int v[] = {...};   /* these are the actual desired values in a[] */
    
    /* the verifying loop */
    int i;
    int cond = 1;
    for (i = 0; i < 100; i++)
    {
        cond = cond && (a[i] == v[i]);
        if (cond)
        {
           /* do something */
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update I have posted my solution to this problem as an answer below. It
Suppose I have a table view, and I want to implement something like this:
I have almost completed the code for this problem, which I shall state as
I have a problem making the link between the underlying socket (in this case,
I have been having this problem wherein my threads stop execution and go into
Two problems with the below code. To begin, I have been scouring this and
I have two problem while running below code Mediaplayer is not stopping because it's
I have had a long problem with this code. I have posted this question
Okay if you would like to know how this numpy array is created look
I have problem pertaining to the maintaining state of the particular @Request scope bean.

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.