ASCII тэмдэгтүүдээс латин том үсгийг гарга.

#include <ctype.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
char *binary(int a)
{ char *b,t=7;
b=(char*)malloc(9);
strcpy(b,"00000000");
while (a) { b[t]=(char)(a % 2 + '0');
a/=2; t--;
}
b[8]=NULL;
return &b[0];
}
main()
{ int i;
printf (" Latin tom usguud:\n\n", i);
printf(" Dec Hex Binary Char ");
printf(" Dec Hex Binary Char \n");
for (i=0;i<256;i++)
if (isupper(i) != 0)
if (i%2!=0) printf("%5d%5X%12s%5c ",i,i,binary(i),i);
else printf("%5d%5X%12s%5c\n",i,i,binary(i),i);
getch();
}

Comments