Thread: sequence of lines

  1. #1
    Registered User
    Join Date
    Apr 2021
    Posts
    2

    sequence of lines

    Hi,

    I got a question to "write the sequence of lines" init, test ... which are executed in a program. How should I understand this?
    Code:
    i = XXX; k = XXX; n = XXX;    // Init
    while (something) {                // Test                     
    if(XXX % XXX == 0) break;     //some
    xx--;                                      // some
    xx++;}                                                                      // some
    printf(”%d”, n);                                         // some

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Maybe you should state the whole question, not some paraphrased mis-understanding of it.

    'if' is also a 'test', not a 'some' (whatever that is).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2021
    Posts
    2
    Hi Salem,

    'If' have a // Cbreak comment. All are just comments. Like 'xx++' is // incrX

    xxx is just variables and values of the variables.

    I'm just confused about how to adress the question of write the sequence of lines.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    What you posted makes no sense.

    i and k are unused.
    something and xx are undeclared.
    x % x is always 0 to begin with, so its always going to break out of the loop.

    The whole lot just seems to reduce trivially to
    printf("%d\n", n);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. im printing 3 lines of the same on all my lines, please help
    By mountaindrew11 in forum C Programming
    Replies: 8
    Last Post: 04-11-2016, 10:57 AM
  2. Translate a string matrix[lines][4] into one[lines][2]
    By muacsom in forum C Programming
    Replies: 3
    Last Post: 06-16-2012, 04:45 PM
  3. % sequence
    By goran00 in forum C Programming
    Replies: 9
    Last Post: 01-28-2008, 04:48 PM
  4. sequence
    By braddy in forum C Programming
    Replies: 2
    Last Post: 03-30-2006, 02:15 PM
  5. sequence
    By Space_Cowboy in forum C++ Programming
    Replies: 1
    Last Post: 12-08-2002, 06:54 PM

Tags for this Thread