Do something to improve things. Anything. Start small or go big. Just do something. Today. Now. The world will be better for it. ----Just because no one else believes in your dreams doesn't mean you shouldn't believe in your dreams. ----The world is the great gymnasium where we come to make ourselves strong. "Swami Vivekananda"

Government Jobs In India Headline Animator

18 March 2010

c_ progrrams.1

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=i;j printf("%c",a[j]);
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:

Subscribe via email

Enter your email address:

Delivered by FeedBurner

website-hit-counters.com
Provided by website-hit-counters.com site.