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

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • 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 →

  • vkp035127
    3 months ago+ 0 comments

    include

    int main() { int a,b; scanf("%d",&a); // printf("\n"); scanf("%d",&b); int i; for(i=a;i<=b && i>=a;i++) { if(i>=1 && i<=9) { if(i==1) printf("one\n"); if(i==2) printf("two\n"); if(i==3) printf("three\n"); if(i==4) printf("four\n"); if(i==5) printf("five\n"); if(i==6) printf("six\n"); if(i==7) printf("seven\n"); if(i==8) printf("eight\n"); if(i==9) printf("nine\n");

        }
        if(i>9 && i%2==0)
        printf("even\n");
        if(i>9 && i%2!=0)
        printf("odd\n");
    }
    return 0;
    

    }

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