Skip to content

Instantly share code, notes, and snippets.

@manthanabc
Created November 30, 2023 21:50
Show Gist options
  • Save manthanabc/bf2c7dd5ff20d0103a3316afb8d035ad to your computer and use it in GitHub Desktop.
Save manthanabc/bf2c7dd5ff20d0103a3316afb8d035ad to your computer and use it in GitHub Desktop.
Print The given number in subscript using 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