Monday, August 20, 2012

Signed and Unsigned Binary Booth Multiplication in C

Booth Multiplication is used to calculate multiplication of signed number as well as unsigned numbers. In Booth multiplication, multiplier and multiplicand are placed in the Q and M registers.
This is the c program of Booth Multiplication. In this program you can enter the signed or unsigned number from 0 to 15. and you can extend the range by modification. Each step of the process was displayed execution of the program. 

Sunday, August 19, 2012

Booth multiplication for binary number

This is the c program of Booth Multiplication. In this program you can enter the signed or unsigned number from 0 to 15. and you can extend the range by modification. Each step of the process was displayed run the program was executed.

/**
*Prepared By: Suresh Ghatuwa, Shreeram Khaitu, Copyright http://www.subirank.com
BOOTH MULTILICATION
*/
#include
#include
#include
#include

int get()
{
int flag=0;
int a;
do
{
printf("ENTER VALUE: ");
scanf("%d",&a);
if(a< 0)
{
a = a * -1;
flag = 1;
}

if(a>=16)
printf("\n\t!INVALID NUMBER.ENTER VALUE (-16 < A < 16)!\n");
}while(a>=16);
if(flag)
a = a *-1;
return(a);
}

void add(int *a,int *b)
{
int x,i,c=0;
for(i=7;i>=0;i--)
{
x=a[i];
a[i]=c^x^b[i];
if(((c==1)&&(x==1))||((x==1)&&(b[i]==1))||((b[i]==1)&&(c==1)))
c = 1;
else
c = 0;
}
}

void binary(int x,int*arr)
{
int i,p=x,c[8]={0,0,0,0,0,0,0,1};
for(i=0;i<8;i++)
arr[i] = 0;
if(x < 0)
x = x *-1;
i = 7;
do
{
arr[i]=x%2;
x = x/2;
i--;
}while(x!=0);
if(p< 0)
{
for(i=0;i< 8;i++)
arr[i]=1-arr[i];
add(arr,c);
}
printf("\n\nTHE BINARY EQUIVALENT OF %d IS : ",p);
for(i=0;i< 8;i++)
printf("%d",arr[i]);
}

void rshift(int x,int *y)
{
int i;
for(i=7;i>0;i--)
y[i] = y[i-1];
y[0] = x;
}

void main()
{ start:
int q=0,i,j,a,b,A[8]={0,0,0,0,0,0,0,0},C[8]={0,0,0,0,0,0,0,1},C1[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
int s=0,z=0,Q[8],M[8],temp,temp1[8],ans[8],y,x=0,c=0,count=8,p;
clrscr();
printf("\n----------------------------------------------------\n");
a = get();
b=get();
printf("%d\n",a);
printf("%d\n",b);
printf("\n---------------------------------------------------\n");
binary(a,M);
binary(b,Q);

printf("\n\n---------------------------------------------------\n");
printf(" Count\t A\t Q\tQ'\t M\t Remark");
printf("\n\n%d\t",count);
for(i=0;i< 8;i++)
printf("%d",A[i]);
printf("\t");
for(i=0;i< 8;i++)
printf("%d",Q[i]);
printf("\t");
printf("%d\t",q);
for(i=0;i< 8;i++)
printf("%d",M[i]);
printf("\tInitial");
printf("\n");
for(j=0;j< 8;j++)
{
if((Q[7]==0)&&(q==1))
{
printf("\n \t");
add(A,M);
for(i=0;i< 8;i++)
printf("%d",A[i]);
printf("\t");
for(i=0;i< 8;i++)
printf("%d",Q[i]);
printf("\t%d\t",q);
for(i=0;i< 8;i++)
printf("%d",M[i]);
printf("\tA:=A+M");
}
if((Q[7]==1)&&(q==0))
{
printf("\n \t");
for(i=0;i< 8;i++)
temp1[i] = 1-M[i];
add(temp1,C);
add(A,temp1);
for(i=0;i< 8;i++)
printf("%d",A[i]);
printf("\t");
for(i=0;i< 8;i++)
printf("%d",Q[i]);
printf("\t%d\t",q);
for(i=0;i< 8;i++)
printf("%d",M[i]);
printf("\tA:=A-M");
}
printf("\n%d\t",--count);
y = A[7];
q = Q[7];
rshift(A[0],A);
rshift(y,Q);
for(i=0;i< 8;i++)
printf("%d",A[i]);
printf("\t");
for(i=0;i< 8;i++)
printf("%d",Q[i]);
printf("\t");
printf("%d\t",q);
for(i=0;i< 8;i++)
printf("%d",M[i]);
printf("\tshift,count--");
printf("\n");
}
printf("\n\n---------------------------------------------------\n");
printf("\nTHE ANSWER IN BINARY IS : ");
for(i=0;i< 8;i++)
ans[i]=A[i];
for(i=0;i< 8;i++)
ans[i+8]=Q[i];
if(((a< 0)&&(b>0))||((a>0)&&(b< 0)))
{
for(i=0;i< 16;i++)
ans[i]=1-ans[i];
for(i=15;i>=0;i--)
{
x = ans[i];
ans[i]=c^x^C1[i];
if(((c==1)&&(x==1))||((x==1)&&(C1[i]==1))||((C1[i]==1)&&(c==1)))
c=1;
else
c=0;
}
}
for(i=0;i< 16;i++)
printf("%d",ans[i]);
for(i=15;i>=0;i--)
{
s = s + (pow(2,z) * ans[i]);
z = z+1;
}
if(((a< 0)&&(b>0))||((a>0)&&(b< 0)))
printf("\nTHE ANSWER IN DECIMAL IS : -%d\n",s);
else
printf("\nTHE ANSWER IN DECIMAL IS : %d\n",s);
printf("\nPress 0 for again and any other for exit:");
scanf("%d",&p);
if(p==0)
{
goto start;
}
getch();
}

Output:





Thursday, August 9, 2012

subirank 9x9 Sudoku Solver

This Sudoku Solver help you to solve the sudoku problem. Enter the number or data in the box or field and press tab to move to another field.



http://www.subirank.com/gallery/others/sudoku-9-9-sudoku-solve/

Wednesday, August 8, 2012

Use pendrive as RAM

In the windows 7, microsoft has introduced new features called ReadyBoost.You can use you pendrive or flashdisk, or memory card as RAM or third memory option in Computer. You can also use pendrive or portable storage as RAM in XP and Vista also.

use MSE without internet (offline users)

Microsoft Security Essential (MSE) is an Microsoft product antivirus that protect against different virus and malware. MSE antivirus runs on windows XP, Windows Vista and Windows 7 but not supported on Windows 8. In windows 8, it has built-
in antivirus component.



Most of the MSE users think that MSE antivirus was for internet user. It was not available for offline user. Now you can use MSE antivirus without internet or offline.

All the necessary files with its process are available in this page

http://www.subirank.com/gallery/security/install-and-use-MSE-without-Internet/

install redhat and centos in virtualbox

Linux is derived from Latin word "Linux Torvalds". Torvalds was a student at the University of Hilsink in Finland in 1996's. He wrote first version of UNIX like kernel as a toy project. Many scientists &student worked together and later dev
eloped Linux. Linux is an Open source network OS. Linux was developed for the intel x86 based computer as a free operating system. More than 90% of the today fastest computer runs on the linux version.



Red Hat Linux, was a popular Linux based operating system until its discontinuation in 2004. Red Hat Linux 1.0 was released on November 3, 1994. Red Hat Linux 9, the final release, hit its official end-of-life on 2004-04-30, although updates were published for it through 2006 by the Fedora Legacy project. Since Linux is old version, old version of linux i.e Red Hat and cent OS was not supported latetst version of hardware. Even the installing the Red Hat 9 and Cent OS was not supported in Virtualbox.


http://www.subirank.com/gallery/solution/install-redhat-and-cent-os-in-virtualbox/

Download the torrent file with IDM

We all use Torrent to download various kinds of files like songs,movies,books,software's and much more.The download speed of torrent depends on many factors like seeders,leeches,peers, Internet connection and much more.Sometimes you may fac
e difficulty in downloading torrent files with less seeds which results in slow download. When Torrent has less seeds, the downlaod speed was also slow. So downloading the torrent file with Internet Downalod Manager is a very good trick to increase the download speed. This Page help you to download the torrent file with IDM.

http://www.subirank.com/gallery/solution/download-the-torrent-file-with-IDM/