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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:59:33+00:00 2026-06-17T04:59:33+00:00

In a school exercise (on paper) i’ve this question: 5) rewrite the code without

  • 0

In a school exercise (on paper) i’ve this question:

5) rewrite the code without using continue and break:

for (i = 0; i < N; i++) {
    scanf("give me an int %d", & a);
    if (a < 0) {
        continue;
    }
    if (a == 0) {
        break;
    }
    /* elaborate positive int */
}

I’m thinking about this:

for(i=0;i<N;i++){

 scanf("give me an int %d",&a");

 if(a==0){return -1; //??i dont know how to exit}
 if(a<0){
  do{
        scanf("give me an int %d",&a");
        if(a==0){return -1; //??i dont know how to exit}
    }while(!(a<0))
 }
 /* elaborate positive int */
}

but, I’m actually not able to do this.. can you help me? thanks 🙂

  • 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-17T04:59:34+00:00Added an answer on June 17, 2026 at 4:59 am
    for(i = 0; i < N && a != 0; i++)
    {
        scanf("give me an int %d",&a");
        if(a>0)
        { /*do stuff*/ }
    }
    if(a==0) i--; //As noted by Daniel Fischer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize for this school-book question but I've been working on this SQL query
Im totally new at this and have a question. I worked with an exercise
After doing my exercise in school, I use Sqlite to store my data. But
I hope this is the proper location to ask this question which is the
For school, we use C++ as the language of choice. I am currently using
I am fairly new to java and I have been struggling with this exercise
if dictionary.has_key('school'): How would you write this in javascript?
For a school prject we have to work with pointers, for this i wanted
I have this small application that I'm building as an exercise to learn the
This is not homework, I don't have money for school so I am teaching

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.