From 28bd98254a97457a96988d4abacbb7bddfad3d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Wed, 24 Jan 2024 18:55:45 +0300 Subject: [PATCH] hex value scanned by scanf and printed --- c-basic/scanf-hex.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 c-basic/scanf-hex.c diff --git a/c-basic/scanf-hex.c b/c-basic/scanf-hex.c new file mode 100644 index 0000000..7226b52 --- /dev/null +++ b/c-basic/scanf-hex.c @@ -0,0 +1,22 @@ +/** + * @file scanf-hex.c + * @author Mert Gör (mertgor@masscollabs.xyz) + * @brief Scanf accepts the int variable as hex if we pass %x + * @version 0.1 + * @date 2024-01-24 + * + * @copyright Copyright (c) 2024 Mert Gör and contributors - GPLv3 or any later + * + */ + +#include + +int main(){ + int a; + int b; + printf("enter a number : "); + scanf("%x", &a); + printf("a = %d\n", a); + + return 0; +} \ No newline at end of file