Hexa to binary in c
#include
#include
void main()
{
unsigned int a,i;
printf ("enter the hexa decimal data to covert to binay \n");
scanf("%x",&a);
for (i=0;i<32;i++)
{
if((a&0x80000000)==0x80000000)
printf("1");
else
printf("0");
a=a<<1;
}
}
.......................................................................................
ROTATE THE GIVEN STRING AND DISPLAY;;
#include
#include
void main()
{
int l,j=0,i ;
char *p,*m;
char a[32],b[32],q;
printf("Enter the string :");
scanf("%s",&a);
l=strlen(a);
printf("lenght==%d\n",l);
for(i=0;i
for(j=0;j printf("%c",a[j]);
printf("\n");
}
}
OUT PUT:
I/P:ASDFG
O/P:
ASDFG
SDFGA
DFGAS
FGASD
GASDF
..................................................................................
PRG TO DELETE A CHARACTER FROM THE GIVEN STRING..
#include
#include
void check(int ,char );
void main()
{
int l,j=0,i ;
char *p,*m;
char a[32],b[32],q;
printf("Enter the string :");
scanf("%s",&a);
printf("Enter the character to delete;\n ");
scanf("%s",&q);
l=strlen(a);
printf("lenght==%d\n",l);
p=a;
m=b;
for(i=0;i
if (*p!=q)
{
*(m++) = *p ;
}
p++;
}
*m++=0;
printf("output string==%s\n",b);
}
OUT PUT:;
I/P:ASDFASDSDS
DELETE :D
O/P
ASFASSS;
.....................................................................................
No comments:
Post a Comment