Search:

Type: Posts; User: Subsonics

Search: Search took 0.02 seconds.

  1. A for loop have these components for (i =...

    A for loop have these components



    for (i = 0; i < 10; i++) {
    /* loop body */
    }


    A semicolon in there will be interpreted as being part of the loop body, i.e an empty statement.
  2. It's the semicolon again, your for loop runs...

    It's the semicolon again, your for loop runs empty. what you have is the same as:



    for(j = 1; j <= number; j=j+1)
    ;
  3. You initialize fact to zero, then you multiply...

    You initialize fact to zero, then you multiply that with i. What happens when you multiply something with zero?
  4. You are missing a semicolon after fact*i. :)

    You are missing a semicolon after fact*i. :)
  5. Wasn't you also suppose to quit, if a number...

    Wasn't you also suppose to quit, if a number isn't 1-10? Otherwise you are just carrying on as if nothing happened.





    if( (number < 1) || (number > 10) ) {
    printf("The number...
  6. You have the answer right at the end there, but...

    You have the answer right at the end there, but you need to change it a bit. 'number' can not be both less than 1 and larger than 10, so use OR instead of AND, that is || so:



    if( (number < 1)...
  7. If you have not used bitwise operators then you...

    If you have not used bitwise operators then you haven't. But actually you could leave that bit since the first requirement (checking the range of the number) is commented out. So, solve that first. I...
  8. Start by commenting out everything but the first...

    Start by commenting out everything but the first part (odd/even), then add them in one after one until they are all working. Looking at the first part:



    /* if ((number > 0 ) && (number <...
  9. What is your question? Does the program work as...

    What is your question? Does the program work as expected or do you have some problem with it, if so what kind of problem?
Results 1 to 9 of 9