Friday, May 31, 2019

Write a program to print decimal numbers to hexa decimal format in arrays...in c

/* ***********************************************
    Write a program to print  decimal numbers to hexa decimal format in arrays

 date:31-05-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>

int main()
{

    int i;
    char ch[30]={120,120,31,18,01,8,69,86,70,33,30,80,42,00,01,140,221,13,10};
    char str[50];
    char str2[50];

    strcpy(str2,"");
    for(i=0;i<20;i++)
    {
         strcpy(str,"");
         sprintf(str,"%x",ch[i]);
         strcat(str2,str);
    }
    printf("%s",str2);

    return 0;
}

No comments:

Post a Comment

python class topic video