Wednesday, January 4, 2012

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.

  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.

  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.

Monday, January 2, 2012

ASCII values printing on CONSOLE

/*program for printing ASCII values*/

#include

void main()
{
int x;
char p;
clrscr();
printf("ASCII values\n");
x=1;
while(x<=255)
{
printf("%d--%c\t",x,x);
x++;
}

getch();
}

ASCII values printing on CONSOLE

/*program for printing ASCII values*/

#include

void main()
{
int x;
char p;
clrscr();
printf("ASCII values\n");
x=1;
while(x<=255)
{
printf("%d--%c\t",x,x);
x++;
}

getch();
}

DECIMAL to BINARY conversion (for a range of decimal values)

/* C program for DECIMAL TO BINARY CONVERSION for a range of values */


#include
void main()
{
int num,i=0,start,end,j;
int bin[10]={0};
clrscr();
printf(" decimal to binary converting\n\n\n");
printf("enter START and END of range: "); //suppose if range is 1to50, then you
scanf("%d%d", &start,&end); //should enter START=1 and END=50
printf("\n\n\t the binary form is :\n\n");
for(num=start;num<=end;num++)
{
i=0;
j=num;
while(j>=1)
{
if(j==1)
{
bin[i]=1;
break;
}
bin[i]=j%2;
j=j/2;
i++;
}

printf("%4d -- ",num);
for(i=9;i>=0;i--)printf("%d",bin[i]);
printf("\n");
}

getch();
}

DECIMAL to BINARY conversion (for a range of decimal values)

/* C program for DECIMAL TO BINARY CONVERSION for a range of values */


#include
void main()
{
int num,i=0,start,end,j;
int bin[10]={0};
clrscr();
printf(" decimal to binary converting\n\n\n");
printf("enter START and END of range: "); //suppose if range is 1to50, then you
scanf("%d%d", &start,&end); //should enter START=1 and END=50
printf("\n\n\t the binary form is :\n\n");
for(num=start;num<=end;num++)
{
i=0;
j=num;
while(j>=1)
{
if(j==1)
{
bin[i]=1;
break;
}
bin[i]=j%2;
j=j/2;
i++;
}

printf("%4d -- ",num);
for(i=9;i>=0;i--)printf("%d",bin[i]);
printf("\n");
}

getch();
}

C program for DECIMAL to BINARY conversion

/* program for DECIMAL to BINARY converter */

#include
void main()
{
int num,i=0,bin,next;
clrscr();
printf(" decimal to binary converting\n\n\n");
printf("enter any decimal no. ");
scanf("%d", &num);
printf("please note that the binary form is represented in the\n form
(LSB ...MSB)\n");
printf("\n\n\t The binary form is :");


while(num>=2)
{
bin=num%2;
num=num/2;
printf("%d",bin); //logic can easily implemented using ARRAYs
if(num==1) //but i am not using arrays here.
printf("1"); //this is the MSB
}

getch();
}

C program for DECIMAL to BINARY conversion

/* program for DECIMAL to BINARY converter */

#include
void main()
{
int num,i=0,bin,next;
clrscr();
printf(" decimal to binary converting\n\n\n");
printf("enter any decimal no. ");
scanf("%d", &num);
printf("please note that the binary form is represented in the\n form
(LSB ...MSB)\n");
printf("\n\n\t The binary form is :");


while(num>=2)
{
bin=num%2;
num=num/2;
printf("%d",bin); //logic can easily implemented using ARRAYs
if(num==1) //but i am not using arrays here.
printf("1"); //this is the MSB
}

getch();
}