Cilem ukolu je naprogramovat prevod cisla v desitkove soustave na cislo ve dvojkove. Úkol odevzdejte do 29.10. Na vstupu bude cislo typu integer nebo long vystupem bude retezec jednicek a nul predstavujici vyjadreni zadaneho cisla ve dvojkove soustave. nejjednodussi metoda prevodu je nasledujici: desitkove cislo se deli dvemi tak dlouho dokud nebude vysledkem 0 a zapisuji se zbytky po deleni, retezec zbytku je vysledkem. priklad: 8:2 = 4 zbytek 0 4:2 = 2 zbytek 0 2:2 = 1 zbytek 0 1:2 = 0 zbytek 1 cislo 8 vyjadrene ve dvojkove soustave je 1000 13:2 =6 zbytek 1 6:2 = 3 zbytek 0 3:2 = 1 zbytek 1 1:2 = 0 zbytek 1 cislo 13 vyjadrene ve dvojkove soustave je 1101 http://www.sallyx.org/sally/c/c02.php http://www.prevod.cz/popis.php?str=564&parent=y http://www.youtube.com/watch?v=UvCZQ5CaWx0 http://www.metacafe.com/watch/343056/convert_decimal_to_binary/ pro kontrolu vysledku: http://conus.pavucina.com/cz/prevody-ciselnych-soustav/ *********************************************************** Create program that convert decimal number to binary. Input is number of integer or long datatype. Output is string of 1's and 0's. Simplist method of conversion is this: Divide decimal number by 2 as long as the result = 0 and write remainders, string of remailder is output. Exemple 8:2 = 4 remainder 0 4:2 = 2 remainder 0 2:2 = 1 remainder 0 1:2 = 0 remainder 1 number 8 in binary code is 1000 13:2 =6 remainder 1 6:2 = 3 remainder 0 3:2 = 1 remainder 1 1:2 = 0 remainder 1 number 13 in binary code is 1101 http://electronicdesign.com/Articles/ArticleID/8912/8912.html http://www.youtube.com/watch?v=UvCZQ5CaWx0 http://www.metacafe.com/watch/343056/convert_decimal_to_binary/ for control http://www.easysurf.cc/cnver17.htm you can control your results by calculator in windows - science version write decimal and click on Bin