Thread: help me to understand the problem in my code

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    11

    help me to understand the problem in my code

    help me to understand the problem in my code in line 13 ?
    help...

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
      int num;
      int i;
    
      do {
        printf("Enter number: ");
        scanf("%d", &num);
      }
      while (num = >5)
      &&(num <= 20);
    
    
      for (i = 1; i < num; ++i) {
        if (i == num) {
          break;
        }
        printf("*\n");
      }
    
      return (0);
    }
    Last edited by Salem; 11-18-2013 at 03:00 PM. Reason: removed all the crappy font/colour tags - use "paste as text" in future

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    while() expect a singular expression and yours has two. Make it one by making it like this:

    Code:
    while ((your expressions) && (in here));
    When you have a question about an error, be sure to include the error.

    And we can't see your line numbers - you need to post code IN PLAIN TEXT, not in your editors text.

  3. #3
    Registered User
    Join Date
    Oct 2013
    Posts
    11
    It still did not help );

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Not surprising. No error copy and paste, and no line numbers, and no code in plain text.

    Also, your laconic answers work fine in Sparta perhaps, but lousy on a programming forum. Just WHAT is "THE PROBLEM"?

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    => is also not an operator. <= is.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  6. #6
    Registered User
    Join Date
    Nov 2013
    Posts
    1
    Your code contains two syntactic error. One is poitned out by Adak, the other by grumpy. Change your line 13 to while (num >= 5 && num <= 20); then all the syntactic error will be eliminated.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help to understand this code !
    By redred in forum C Programming
    Replies: 5
    Last Post: 03-14-2013, 10:31 AM
  2. Replies: 2
    Last Post: 03-08-2010, 06:19 PM
  3. I don't understand this code
    By Nazgulled in forum C Programming
    Replies: 2
    Last Post: 12-18-2007, 01:52 PM
  4. Need help to understand this STL code.
    By Hulag in forum C++ Programming
    Replies: 3
    Last Post: 04-26-2005, 01:59 PM
  5. I want to understand this code
    By BadProgrammer in forum C++ Programming
    Replies: 9
    Last Post: 12-18-2003, 02:39 PM