/*
P R O G R A M M B E S C H R E I B U N G

In diesem Demo-Programm werden 3 über Tastatur 
eingegebene Zahlen der Größe nach sortiert 
(aufsteigende Reihenfolge) und 
auf dem Bildschirm ausgegeben.
*/



#include "stdafx.h"
#include "stdio.h"

int main(){
	int z1, z2, z3, m, k, g;

	// Eingabe			
	printf("Eingabe der 1. Zahl: \n");
	scanf("%d", &z1);
	fflush(stdin);
	printf("Eingabe der 2. Zahl: \n");
	scanf("%d", &z2);
	fflush(stdin);
	printf("Eingabe der 3. Zahl: \n");
	scanf("%d", &z3);
	fflush(stdin);
  
	// Verarbeitung			
	if (z1<z2){
		if(z3<z1){
			k=z3;
			m=z1;
			g=z2;
		}
		else{
			if(z3<z2){
				k=z1;
				m=z3;
				g=z2;
			}
			else{
				k=z1;
				m=z2;
				g=z3;
			}
		}
	}
	else{
		if(z3<z2){
			k=z3;
			m=z2;
			g=z1;
		}
		else{
			if(z3<z1){
				k=z2;
				m=z3;
				g=z1;
			}
			else{
				k=z2;
				m=z1;
				g=z3;
			}
		}
	}
	
	// Ausgabe			
	printf("sortierte Reihenfolge %d %d %d: \n", k, m, g);
	return 0;
}