| 
    1/* PASCAL Stil */ 
   2 
   3int 
   4f1 (void) 
   5{ 
   6  int a[100]; 
   7  int j, 
   8    t, 
   9    s; 
  10 
  11  for (j = 0; j < 50; j++) 
  12    { 
  13      t = a[j]; 
  14      a[j] = a[100 - j - 1]; 
  15      a[100 - j - 1] = t; 
  16    } 
  17 
  18  s = 0; 
  19  for (j = 0; j < 100; j++) 
  20    { 
  21      s += a[j]; 
  22    } 
  23 
  24  return s; 
  25} 
  26 
  27/* besser */ 
  28 
  29int 
  30f2 (void) 
  31{ 
  32  int a[100]; 
  33 
  34  { 
  35    int j; 
  36 
  37    for (j = 0; j < 50; j++) 
  38      { 
  39        int t; 
  40 
  41        t = a[j]; 
  42        a[j] = a[100 - j - 1]; 
  43        a[100 - j - 1] = t; 
  44      } 
  45  } 
  46 
  47  { 
  48    int j, 
  49      s; 
  50 
  51    for (j = 0, s = 0; j < 100; j++) 
  52      { 
  53        s += a[j]; 
  54      } 
  55 
  56    return s; 
  57  } 
  58} 
 | 
    
| Letzte Änderung: 11.01.2007 | © Prof. Dr. Uwe Schmidt |