Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* 2024/25/2
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Hexadecimal, octal and binary numbers

(1) hex(), oct(), bin()
def main():
    n = 2025
    print("Decimal:", n)  # 2025
    print("Hexa:", hex(n))  # 0x7e9
    print("Octal:", oct(n))  # 0o3751
    print("Binary:", bin(n))  # 0b11111101001

    # ----------

    print(int("0x7e9", 16))  # 2025
    print(int("7e9", 16))  # 2025
    print(int("0o3751", 8))  # 2025
    print(int("0b11111101001", 2))  # 2025
import std.stdio;
import std.format;
import std.conv;

void main()
{
    int n = 2025;
    writeln(format("Decimal: %d", n)); // 2025
    writeln(format("Hexa: %x", n)); // 7e9
    writeln(format("Octal: %o", n)); // 3751
    writeln(format("Binary: %b", n)); // 11111101001

    string hexa = format("%x", n);
    writeln(hexa); // 7e9

    // ----------

    // writeln(to!int("0x7e9", 16)); // error, remove "0x"
    writeln(to!int("7e9", 16)); // 2025
    writeln(to!int("3751", 8)); // 2025
    writeln(to!int("11111101001", 2)); // 2025
}
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 June 28, 21:03