Saturday, May 25, 2019

hexa decimal number in c programming

//program 1

#include <stdio.h>
int main()
{
int arr[]={0x78, 0x78};
int i;

printf("Array elements are\n");
for(i=0;i<2;i++)
printf("Hex: %X\n",arr[i]);

return 0;
}


//program 2

#include <stdio.h>
int main()
{
unsigned char a=0x64;
int b=0xFA;

printf("value of a: %X [%x]\n",a,a);
printf("value of b: %X [%x]\n",b,b);

return 0;
}

c programming form a program to print large number using conditional operator

//a program to print large number using conditional operator
#include <stdio.h>
#include <stdlib.h>

int main()
{
   int a,b,max;
   printf("enter values for a and b");
   scanf("%d %d",&a,&b);
   max = a>b ? a:b;
   printf("entered values are%d,%d,%d",a,b,max);
       return 0;
}

c programming //getchar and putchar test

//getchar and putchar test


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

int main()
{
    char ch;
    printf("enter a character\n");
    ch = getchar();
    printf("entered character is ");
    putchar(ch);
    return 0;
}

python class topic video