Created
November 30, 2023 21:50
-
-
Save manthanabc/4b4fe8ab51d332a715926e729914ba56 to your computer and use it in GitHub Desktop.
Print The given number in subscript using unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <stdio.h> | |
int print_up(int input) | |
{ | |
SetConsoleOutputCP(CP_UTF8); | |
int rev=0; | |
while(input) { | |
rev=rev*10+input%10; | |
input=input/10; | |
} | |
while(rev) { | |
int x=rev%10; | |
putchar((x>=4)? 0xE2: 0xC2); | |
putchar((x>=4)? 0x81: (x==1)? 0xB9:0xB0+x); | |
putchar((x>=4)? 0xB0+x: 0); | |
rev/=10; | |
} | |
} | |
int main() { | |
int input; | |
scanf("%d", &input); | |
printf("X"); | |
print_up(input); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment