Guest User

aufgabe19

a guest
May 31st, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. // aufgabe19.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6.  
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {
  9.     int values[2] = {0};
  10.     printf("Bitte geben Sie den Startwert ein:");
  11.     scanf("%d", &values[0] );
  12.     printf("Bitte geben Sie den Stopwert ein:");
  13.     scanf("%d", &values[1] );
  14.    
  15.     int i = 1;
  16.     if(values[0] > values[1]) {
  17.         i = -1;
  18.     }
  19.     if(values[0] == values[1]) {
  20.         printf("%d\n", values[1]);
  21.         return 0;
  22.     }
  23.  
  24.     while(values[0] != values[1]) {
  25.         printf("%d,\n", values[0]);
  26.         values[0] += i;
  27.     }
  28.  
  29.     printf("%d\n", values[1]);
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment