We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. C
  3. Conditionals and Loops
  4. For Loop in C
  5. Discussions

For Loop in C

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • shubhamascoder
    2 months ago+ 0 comments

    WHere am I wrong and How can I make the program right?

    include

    include

    include

    include

    int main() { int a, b; scanf("%d\n%d", &a, &b); for (int i=0; i

        if(a%2==0){
            printf("even\n"); break;
        } else {
            printf("odd\n"); break;
        }
    
      }
      for(int l=0;l<b+1;l++){
           if(b%2==0){
            printf("even\n"); break;
        } else {
            printf("odd\n"); break;
        }
      }
    
    return 0;
    

    }

    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy