Friday 15 June 2012

c - Hi, can somebody help me with this loop -


Sorry for the question, but I have no other place, and this is happening to me that I Solution. I am quite good with Pascal programming language, so this language is very familiar to me, but if a function that changes the entire structure of a loop then it is very complicated for me. Please any help is appreciated.

There is a sequence of ten numbers in the array variable. While inside the loop, you should write two if the condition, which changes the flow of the loop in the following way (without changing the printf command):

  • If the present number which is approximately to be printed Less than 5, do not print it.
  • If the current number that is about printing is more than 10, do not print it and stop the loop.

    Note that if you do not move the operator converter and you use the released derivative, you will be trapped in an infinite loop.
      #include & lt; Stdio h & gt; Int main () {int array] = {1, 7, 4, 5, 9, 3, 5, 11, 6, 3, 4}; Int i = 0; While (i & lt; 10) {/ * your code goes here / / printf ("% d \ n", array [i]); I ++; } Return 0; }    

    This is examining your understanding of C flow control which you Looking for something like this:

      if (array [i] <5) {i ++; to continue; } // Increase the salary, while returning back (array [i] & gt; 10); // While      

No comments:

Post a Comment