title: storing multiple values in c language without using arrays
body: <p>have to reverse number and get difference between normal and reverse number.
   The input consists of N numbers, where N is an arbitrary positive integer. The first line of the input
     contains only a positive integer N. Then follows one or more lines with the N numbers; these numbers
      should all be non-negative and may be single or multiple digits. These are the original numbers you need
     to generate their N corresponding magic numbers.</p>
  
  <p>i was thinking maybe using a while loop and just doing one input at a time, anyone have any thoughts?</p>
  
  <p>what i have so far</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int reverseInteger();
  int generateMagicNumber();
  
  int main()
  {
      int n,i;
      char all;
      printf("How many magic numbers do you want");
      scanf("%d",&amp;n);
  
      while (i&lt;n){        //
          while (n != 0) //reversing number
              {
                  rev = rev * 10;
                  rev = rev + n%10;
                  n = n/10;
                  i++;
                  all =  n;
              }
      }
  }
  </code></pre>
  
  <p>Assignment 1: </p>
  
  <blockquote>
    <p>Reverse Number Magic Sequence</p>
    
    <p>Due: Wednesday January 27, 2016 11:59pm EST</p>
    
    <p>A reverse number is a number written in arabic numerals, but where the
    order of digits is reversed. The first digit becomes the last and vice
    versa. For example, the number 1245 when its digits are reversed it
    would become 5421. Note that all the leading zeros are omitted. That
    means if the number ends with a zero, the zero is lost by reversing
    (e.g. 1200 gives 21). Also note that the reversed number never has any
    trailing zeros. Finally, every single digit number (i.e. 0-9) is its
    own reverse number. In order to generate a magic number, we reverse a
    given original number and store the absolute value of the difference
    between the original number and its reversed version. For example,
    given the number 476, we will generate the reverse number 674 and then
    compute the absolute value of the difference between 476 and 674 to be
    198. We then reverse 198 to display the number 891; we call that the magic number!</p>
    
    <p>We need your help to compute the magic numbers of a given sequence.
    Your task is to calculate the difference between a given number and
    its reverse version, and output the reverse of the difference. Of
    course, the result is not unique because any particular number is a
    reversed form of several numbers (e.g. 21 could be 12, 120 or 1200
    before reversing). Thus we must assume that no zeros were lost by
    reversing (e.g. assume that the original number was 12). </p>
    
    <p>Input <br>
    The
    input consists of N numbers, where N is an arbitrary positive integer.
    The first line of the input contains only a positive integer N. Then
    follows one or more lines with the N numbers; these numbers should all
    be non-negative and may be single or multiple digits. These are the
    original numbers you need to generate their N corresponding magic
    numbers. </p>
    
    <p>Output <br>
    For each original number in the sequence, print
    exactly one integer – its magic number. Omit any leading zeros in the
    output. On a separate line, output the largest absolute difference
    encountered in the sequence. Sample Input</p>
  
  <pre><code>6
  24 1 4358 754 305 794
  Sample Output
  81 0 6714 792 891 792
  4176
  </code></pre>
    
    <p>Specific Requirements: [15 pts]</p>
    
    <ul>
    <li>[ 3 pts] Write a function called reverseInteger, that takes as input an unsigned integer and returns its reversed digits version as an
    unsigned integer.</li>
    <li>[ 3 pts] Write a function called generateMagicNumber, that takes as input an unsigned integer and return its magic number as described in
    the problem.</li>
    <li>[ 3 pts] Display the sequence of magic numbers correctly. (shown in the script file)</li>
    <li>[ 2 pts] Display the largest absolute difference (shown in the script file)</li>
    <li>[ 3 pts] Demonstrate the complete program using a main function capable of processing the input of any sequence and producing its
    corresponding output.</li>
    <li>[ 1 pt] Compilation on the CS server gcc compiler without errors and warnings.</li>
    </ul>
    
    <p>Failure to properly document your entire code will receive a mark of
    zero.</p>
    
    <p>You are to submit the following:</p>
    
    <ul>
    <li>Source code file: assign1.c</li>
    <li>Script file demonstrating the compilation and execution : assign1.txt</li>
    </ul>
    
    <p>To generate the script file use the following command from the CS
    server:</p>
  
  <pre><code>cp assign1.c assign1.backup
  typescript assign1.txt
  cc assign1.c
  a.out
  [test your code here with at least 3 different input test cases in addition to the example given]
  exit
  [These steps will create a file called assign1.txt. Do not edit its contents - just submit it!]
  </code></pre>
    
    <p>Hint: This table explains the work done in this example:</p>
  
  <pre><code>Originalnumber
  Reverse Absolute difference
  Reverse (Magic number)
  
  X Xr |X-Xr| |X-Xr|r
  24 42 18 81
  1 1 0 0
  4358 8534 4176 6714
  754 457 297 792
  305 503 198 891
  794 497 297 792
  </code></pre>
    
    <p>Note that your program should not use arrays and should be able to
    read a sequence of N size, for any value of N (a 32 bit integer). Of
    course, memory space optimization should be considered since there is
    no need to store all the N numbers in memory all at once at any given
    time.</p>
  </blockquote>