All pastes #1589638 Raw Edit

konverter

public text v1 · immutable
#1589638 ·published 2009-10-02 16:18 UTC
rendered paste body
Ablaufplan fuer ein Programm, das nach einer Dezimalzahl =>0 fragt und diese als Binaerzahl zurueckgibt.

START

INPUT dezimalzahl
temp := dezimalzahl

testzahl := 0
ausgabestring :='0'

IF dezimalzahl = testzahl
   PRINT ausgabestring  -->  STOP
ENDIF

testzahl := 1
ausgabestring := '1'

IF dezimalzahl = testzahl
   PRINT ausgabestring -->  STOP
ENDIF

WHILE  testzahl < dezimalzahl  DO
  testzahl := testzahl * 2
  ausgabestring := ausgabestring + '0'
  IF dezimalzahl = testzahl
     PRINT ausgabestring -->  STOP
  ENDIF
LOOP

testzahl := testzahl / 2
ausgabestring := '1'
temp := temp - testzahl

WHILE  temp > 0  DO
  testzahl := testzahl / 2
  IF temp => testzahl
     ausgabestring := ausgabestring + '1'
     temp := temp - testzahl
  ELSE
     ausgabestring := ausgabestring + '0'
  ENDIF
LOOP

PRINT  ausgabestring

STOP