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;
}

program to print reverse of the given numbers...in c

/* ***********************************************
    Write a program to print reverse of the given numbers

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

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

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

int main()
{   int a=0,b=0;
    printf("please enter a number\n");
    scanf("%d",&a);
    b=a%10;
    printf("%d",b);
    b=a/10;
    a=b%10;
    printf("%d",a);
    a=b/10;
    printf("%d\n",a);
    return 0;
}

python class topic video