"O GOD THEE I PRAY INCREASE MY KNOWLEDGE DAY BY DAY"

.

For Success

For Success
Know more than other Work more than other But, Expect less than other

Its a necessary and sufficient condition-----

Its a necessary and sufficient condition-----
"If you win, you need not have to explain.........But if you lose, you should not be there to explain!"

07 October 2010

complements

Complements

The complement of a number is a number which when added to the original will make it equal to a multiple of the base of the number system.

Generally the base is represented by ‘r’. so we cancategorized complement in the term of ‘r’
1. r’s complement
2. (r-1)’s complement
General complement table of normally used bases:
No.System ‘r’ r’s complement
(r-1)’s complement

Binary 2 2’s complement
1’s complement

Octal 8 8’s complement
7’s complement

Decimal 10 10’s complement
9’s complement

Hexadecimal 16 16’s complement
15’s complement


Rules:
• Farmula for r’s complement: rn -N
r = base
N = given +ve number
n = the number of digits in the integer part of N

• Farmula for (r-1)’s complement: rn – r -m - N
m = the number of digits in the fractional part
Example: Find 10’s complement of (1789)10
Sol: here r = 10 , n = 4 , N = (1789)10
= rn –N = (104)10 -(1789)10
= 10000 – 01789 = (8211)10

Example: Find r’s complement of (998)16
Sol: here r = 16 , n = 3 , N = (998)16
= rn –N = (163)10 -(998)16
= (4096)10 -(998)16
= (1000)16 -(998)16 = (0002)16
Example: Find 9’s complement of (1789)10
Sol: here r = 10 , m=0, n = 4 , N = (1789)10
= : rn – r -m - N = ( rn – r 0 )- N = (rn – 1)10 – N
=( 104-1 )10 -(1789)10
= 10000 –1- 01789 = (8210)10

Note: If there is no fractional value then the farmula= (rn – 1)10 – N

Example: Find ( r-1)’s complement of (111.10)10
Sol: here r = 2 , n = 3 ,m = 2, N = (111.10)16
= rn – r -m - N = ( 23 – 2 -2 )^10 - N = (8 – .25)10 – N = (7.75)10 -(111.10)2
= (111.11)2 -(111.10)2
= (000.01)2


Signed numbers:
Sign Complement form -----*1’s complement * 2’s complement form
Sign magnitude form
Ones' complement
In ones' complement, the inverse of a number is formed by complementing each bit — that is, performing a bitwise NOT operation. For example:
0101 = +5
1010 = -5
A side effect of both this and the previous system, one of the reasons these systems are not often used for computing, is that there are two representations for zero. In ones' complement:
0000 = +0
1111 = -0
In sign-magnitude:
0000 = +0
1000 = -0

Rules for 1’s COMPLEMENT of a binary number
Under this method first we have to find out the given number’s sign
1. I f the number is +ve, then the binary equivalent is the complement
2. If the number is –ve, then ,
Step 1 – change in binary equivalent
Step- 2 - REPLACE 0 BY 1 AND 1 BY 0
Ex. (+77)10
Step:1-------Binary equivalent of 77 = (1001101)2
Step:2-------It’s 1’s Complement = 1001101
Step:--------Given number’s sign is +ve , so the answer: 1001101
Note: If the answer is required in 16 bit buffer then the answer is 0000000001001101

Ex. (-77)10
Step:1-------Binary equivalent of 77 = (1001101)2
Step:2-------Sign is –ve so, It’s 1’s Complement = 0110010

Note: If the answer is required in 16 bit buffer then the answer is 1111111110110010

2’s COMPLEMENT
Two's complement is the most widely used system in modern computing. To form the two's complement, take the bitwise NOT of the number and add 1. For example:
0101 = +5
1011 = -5
Thus:
0000 = decimal 0 1000 = decimal -8
0001 = decimal 1 1001 = decimal -7
0010 = decimal 2 1010 = decimal -6
0011 = decimal 3 1011 = decimal -5
0100 = decimal 4 1100 = decimal -4
0101 = decimal 5 1101 = decimal -3
0110 = decimal 6 1110 = decimal -2
0111 = decimal 7 1111 = decimal -1
Using this system, 16 bits will encode numbers from −32,768 to 32,767, while 32 bits will encode −2,147,483,648 to 2,147,483,647.
The great advantage of the two's complement system is that most operations are not dependent on the sign of the operands and furthermore are identical to operations on unsigned binary integers.
For instance, 5 + (-5) would be performed like this:
0101
+1011
10000
However, seeing as we have taken the numbers as 4 bits long, the leading 1 is discarded and we have the expected result of 0.
The fact that most operations work no matter the sign of the operands can be explained through the duplicity of numbers modulo 2n; e.g. 15 ≡ -1 (mod 16). Computers generally use a fixed number of bits for binary numbers and thus such a system is ideal. Essentially the only difference between two's complement numbers and unsigned numbers is how they are displayed and compared.
One quirk of two's complement is that the lowest encodable number (e.g. -32768 for 16 bit numbers) appears to be its own negative. However, this rarely causes problems.
As a number composed entirely of 1s (such as 11111111) equates to -1 in two's complement notation, many programming languages use -1 for true and 0 for false.
Rules for 2’s COMPLEMENT of a binary number

Under this method first we have to find out the given number’s sign
3. I f the number is +ve, then the binary equivalent is the complement
4. If the number is –ve, then ,
Step 1 – change in binary equivalent
Step- 2 – find the complement by replacing 0 by 1 and 1 by 0
Step-3- add 1 In step one’s result

Ex. (+77)10
Step:1-------Binary equivalent of 77 = (1001101)2
Step:2-------It’s 1’s Complement = 1001101 = It’s 2’s Complement
Step:3--------Given number’s sign is +ve , so the answer: 1001101
Note: If the answer is required in 16 bit buffer then the answer is 0000000001001101

Ex. (-77)10
Step:1-------Binary equivalent of 77 = (1001101)2
Step:2-------Sign is –ve so, It’s Conversion = 0110010
Step-3: ----- 0110010 + 000001 = 0110011
It’s 2’s Complement = 0110011
Note: If the answer is required in 16 bit buffer then the answer is 1111111110110011

Practice: change these decimal numbers in binary one’s complement & 2’s complement & compare them—99, 1786 ,786

binary airthmetic

BINARY ARITHMETIC

The binary numeral system or base 2 number system is numeral system that represents numeric values using two symbols usually 0 and 1. More specifically, the usual base 2 system is a positional notation with a radix of 2. Owing to its straight forward implementation digital electronic circuitry using logic gates, the binary system is used internally by all modern computers.
A binary number can be represented by any sequence of bits (binary digits) which in turn may be represented by any mechanism capable of being in two mutually exclusive states.

The following sequence of symbols could all be interpreted as the same binary numeric values of 667.

1 0 1 0 0 1 1 0 1 1
x o x o o x x o x x
y n y n n y y n y y

the usual arithmetic taught in school uses the decimal number system. A number such as 394 [three hundred ninety four] is called a decimal number.

394 = 3 x 100 + 9 x 10 + 4 x 1
= 3 x 102 + 9 x 101 + 4 x 100

The number is also said to be written in base 10. the position of the digits in a particular number indicates the magnitude of the quantity represented and can be assigned a weight.

Binary digits also follow some rules and regulation for arithmetic operations as like as decimal numbers . in this chapter we will discuss these operations:








ADDITON :-
Binary addition is carried out in the same way as decimal addition. The rules for four possible additions of two binary numbers A and B and their results are given in table below:

A B Sum
0 + 0 0
0 + 1 1
1 + 0 1
1 + 1 10

The last addition viz. 1+1 = 10 may be understood clearly. This is so written because the largest digit in the binary system is 1. the result of the sum greater than 1 will require that a digit be carried over. Hence, the last addition, in fact, implies that 1+1 = 0 plus a carry of 1 to the next right column. Thus for further addition, the above table may be rewritten as follows:-



A B Sum Carry
0 + 0 0 0
0 + 1 1 0
1 + 0 1 0
1 + 1 0 1
1+1+1 1 1

For addition of 3 or more bits, two bits are added at a time and the above rules are repeated for further additions



E X . Add 10111111 and 11111101


carry 1111111
10111111
+ 11111101
Ans: 110111100

Practice: add these
1. 101+111
2. 1111+1011
3. 1010101+1111000
4. 110101+10001
5. 10111111+11111111
Answers:
1.1100, 2. 11010, 3. 11001101, 4. 1000110, 5. 110111110

SUBTRACTION:
As like as decimal system binary subtraction is same.
Subtrahend- S-number to be subtracted
Minuend- M- number from which other number subtracted
In this operation we have to check which is greater –subtrahend or minuend
If M > S, then subtraction is performed.
If S > M, then borrow is required from left column- In decimal borrower is 10 , but in binary borrower is 2

RULES :-

A B Subtraction
0 - 0 0
0 - 1 1 ( with a borrow of 1)
1 - 0 1
1 - 1 0


Ex. Subtract 1101 from 10011

BORROW 012
10011
- 01101
Ans: 00110




BORROW 012
10101001
- 10011111
Ans: 00001010

Practice & check :
1. 110101-10001=100100
2. 1010101-101001=101100
3. 10011-01111=00100


Additive method of Subtraction/ Complementary subtraction:

Rules & regulation for this:
1. Find the complement of Subtrahend
2. Then, Complement of S + Minuend
Now there can be two conditions occurs:
If no carry- then find the recomplement of the sum( previous result)- & attach a –ve sign with the result
If a carry comes then add it to obtained result

Example: Subtract 10011111 from 10101001 using addative approach
Step-1 complement of 10011111= 01100000
Step-2 10101001
+01100000
00001001
Carry + 1
Result 00001010

Example: Subtract 1000 from 0101
Step:1 Complemnet of 1000 is 0111
Step:2 0101
0111
+1100- With no carry
Step 3 complement of 1100 is 0011
Result is = - 0011


MULTIPLICATION

RULES :- There are only 4 conditions.
s
A B Multiplication
0 * 0 0
0 * 1 0
1 * 0 0
1 * 1 1
Ex.
1110
x 1011
——————
1110
1110x
0000xx
1110xxx
—————
10011010
—————

Practice:
Multiply these and prove it
1110*1011= 10011010
11101*1100 =101011100

Additive method of multiplication:
This approach is simpler but very lengthy. Mostly computers use this approach due to their high speed to perform operations.



DIVISION

RULES :-
there only two conditions.
0/1=0
1/1=1
• compare divisor with dividend.
• If , dividend > divisor
Then, take value of quotient 1 and subtract the divisor from the corresponding digits of dividend.
If , Divisor > Dividend
Then, take value of the quotient 0 and repeat whole process till sufficient digits in dividend
Exmple: Divide a binary digit 1010 by binary 10

Divisor Dividend quotient
10 1010 101
10
0010
10
0000 –Reminder
Exmple: Divide a binary digit 1100111 by binary 111

Divisor Dividend quotient
111 1100111 01110
111
1011
111
1001
111
101 --Reminder


Additive method:
Example: Divide 10001 by 110
10001 - 110 = 01011 1
1011 – 110 = 0101 – reminder 1
Quotient 10

number system for my first semester students

Commonly used Number systems are:-
(A) Decimal number system
(B) Binary number system
(C) Octal number system
(D) Hexa-decimal number system


Number System Available Digits Base Value
Decimal 0,1,2,3,4,5,6,7,8,9 10
Binary 0,1 2
Octal 0,1,2,3,4,5,6,7 8
Hexa-Decimal 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F 16
In any number system digits are arranged in order of ascending value, moving from the lowest on the right to the highest on the left. That’s why the leftmost digit is referred to as the most significant and the rightmost as the least significant digit. As shown:

Most significant (MSB) Least significant (LSB)

X8 X7 X6 X5 X4 X3 X2 X1 X0

 Decimal Number System: -

It is most common number system, which is used usually. It contains 10 different digits, 0 to 9. In the decimal system, each weight equals 10 raised to the power of its position. The weight of its first position, is 100,which equals 1. So, the value of a digit in the first position is equal to the value of the digit times 1. The weight of the second position is 101 ,which equal to 10. The value of a digit in the second position, therefore, is equal to the value of the digit times 10, and so.

Position Forth Third Second First
Weight 103 (1000) 102(100) 101(10) 10(1)


EXAMPLE:
Show the weighting of the decimal number 1789:

1 7 8 9 Digit
103 102 101 100
 Weight
1000 100 10 1

1000 700 80 9

Value Of 1789 = 9*100+8*101 +7*102+1*103 = 9*1+8*10+7*100+1*1000 = 9+80+700+1000
Practice Exercise : 998, 6300, 786


Position Fifth Fourth Third Second First
Weight 24(16) 23(8) 22(4) 21(2) 20(1)

EXAMPLE:

1 0 0 1 Digit
8 4 2 1 Weight
(23) (22) (21) (20)

1*23 0*22 0*21 1*20

Value = 8+0+0+1= (9) 10
The value of the binary number can be computed using defined farmula.
(10101)2== 1*20+0*21 +1*22+0*23+1*24= 1*1+0*2+1*4+0*8+1*16 =1+0+4+0+16 = (21)10

 Octal Number System: -
Computer programmers to represent binary number in a compact form use it. The octal system uses eight symbols, 0 to 7. In this weight 8 is raised to the power is represented by a position.

Position Fifth Fourth Third Second First
Weight 84(4096) 83(512) 82(64) 81(8) 80(1)

Relation between Binary & Octal Number System
Decimal Number Octal Number Binary Number
0 0 000
1 1 001
2 2 010
3 3 011
4 4 100
5 5 101
6 6 110
7 7 111

To calculate the value of a number, we multiply each digit or symbol by the weight due to its position and then we add the results.

EXAMPLE: 2211with octal base
2 2 1 1 =>Digit
(83) (82) (81) (80)

512 64 8 1 =>Weight due to position

2*512 2*64 1*8 1*1
Value = 1024+128+8+1 = (1161)10

 Hexadecimal Number System: -

Hexa–decimal number system use 16 different symbols to represent data. The permitted digits (symbols) in this system are: -0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Hexa-decimal number system is used extensively in modern digital computers these days. It is convenient and simple to represent large binary numbers into smaller Hexa-decimal format. Hence for convenience in representing large or complex numbers, the hexa-decimal numbers are used.

Relation between Binary & Hexa-Decimal Number System
Decimal Number Hexa-Decimal Number Binary Number
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111

Here weight is 16 raised to power represented by a position as:


Position Fourth Third Second First
Weight 163(4096) 162(256) 161(16) 160(1)


To calculate the value of a number, we multiply each digit of symbol by weight due to its position and then we add the results.
EXAMPLE:
4 4 4 4 =>Digit
(163) (162) (161) (160)

4096 256 16 1 =>Weight

4*4096 4*256 4*16 4*1
Value = 16384+1024+64+4 = (17476)10


CONVERSION FROM ONE NUMBER SYSTEM TO ANOTHER-
In this chapter we are going to discuss these conversions with rules –regulations and their corresponding examples:

A….CONVERTING TO DECIMAL FROM ANOTHER BASE

B…CONVERTING FROM DECIMAL TO A NEW BASE

C…CONVERTING FROM A BASE OTHER THEN 10 TO A BASE OTHER THAN 10
D… CONVERSION FOR FRACTIONAL NUMBERS
• OTHER BASE TO DECIMAL

• DECIMAL TO OTHER BASE



A…CONVERTING TO DECIMAL FROM ANOHER BASE

Rules &Regulation:

TO CONVERT A NO. IN DECIMAL MULTIPLY EACH DIGIT WITH THEIR POSITIONAL VALUE AND ADD THEM.

Example:…………

(10101)2 = (?)10

=1*20+0*21+1*22+0*23+1*24
=1*1+0*2+1*4+0*8+1*16
=1+0+4+0+16
=(21) 10
Another method:
(10101)2 = (?)10
=1*24+0*23+1*22+0*21+1*20
=(16 X 1)+(0 X 8)+(4 X 1)+(2 X 0)+(1 X 1)
=16+0+4+0+1
=(21) 10

(7011)8 =(?)10
=(7 X 512)+(0 X 64)+(1 X 8)+(1 X 1)
=3584+0+8+1
=(3593) 10

(BF1) 16=(?)10
=(B X 256)+(F X 16)+(1 X 1)
=(11 X 256)+(15 X 16)+(1 X 1)
=(3057) 10

For Practice:
1. Change theses binary numbers in decimal- 11, 10101,1101011
2. Change theses Octal numbers in decimal – 123, 2345, 4567, 567
3. Change theses Hesadecimal numbers in decimal- ABCD, 99DE, CA998
Prove these:
1. 101001 in binary = 41 in decimal
2. 7012 in octal = 3594 in decimal
3. 312 in base 4 = 54 in decimal
4. BFA in hexadecimal = 3313 in decimal
5. A1A in base 12 = 1462 in decimal

B…CONVERTING FROM DECIMAL TO A NEW BASE

Rules &Regulation:

1. DIVIDE THE DECIMAL NO. BY NEW BASE
2. RECORD THE REMAINDER
3. DIVIDE THE QUOTIENT OF STEP 1
4. RECORD THE REMAINDER FROM STEP 3
5. REPEAT STEP 3 & 4 UNTIL THE QUOTIENT BECOMES 0
6. ARRANGE THE REMAINDERS IN REVERSE ORDER



Example:

1. Find (36)10 =(?)2

DIVISION QUOTIENT REMAINDER
36/2 18 0
18/2 9 0
9/2 4 1
4/2 2 0
2/2 1 0
1/2 0 1

THE REMAINDER HAS TO BE ARANGED IN REVERSE ORDER*

= (100100)2
Check it- 0*1+0*2+1*4+0*8+0*16+1*32 =0+0+4+0+0+32 =36 in decimal




• 2. Find (1789) 10 =(?)8

DIVISION QUOTIENT REMAINDER
1789/8 223 5
223/8 27 7
27/8 3 3
3/8 0 3

=(3375) 8

Check it:
3375 in octal = 5*1+7*8+3*64+3*512 =5+56+192+1536 =1789 in decimal

• 3. Find (623) 10 = ?16

DIVISION QUOTIENT REMAINDER
623/16 38 15 (F)
38/16 2 6
2/16 0 2
= (26F) 16
4. Find (998)10 =(?)16

DIVISION QUOTIENT REMAINDER
998/16 62 6
62/16 3 14 (E)
3/16 0 3

THE REMAINDER HAS TO BE ARANGED IN REVERSE ORDER*

= (3E6) in hexadecimal

Check it- 6*1+14*16+3*256 = 6+224+768 = 998 in decimal

• Integer with fractional part ( Decimal to Binary)
Rules:
1. We multiply given fractional part by 2 and note the result in separate column.
2. The successive fractional parts of the previous result are multiplied by 2 till the fractional part of the product become 0 or up to the accuracy.
3. The integer part of the product is written in downward direction to find the binary equivalent of the decimal fraction.
Example;
Change a decimal number 0.68 in binary equivalent?
Process Product decimal part integer part
0.68*2 1.36 .36 1
0.36*2 0.72 .72 0
0.72*2 1.44 .44 1
0.44*2 0.88 .88 0
0.88*2 1.76 .76 1

So, 0.68 in decimal = 0.10101 in binary
Practice:
Prove these:
1. 247 in decimal = 187 in base 12
2. 47 in decimal = 142 in base 5
3. 101.07 in decimal = 1100101.00010 in binary
4. 75.68 in decimal = 1001011.10101
Find these:
5. change decimal 786 in base 2, 8, 16, 5, 12, 6 and check yourself




C…CONVERTING FROM A BASE OTHER THEN 10 TO A BASE OTHER THAN 10

There are two methods to solve this type of problem

Indirect Method: for this conversion we follow this rule
TO CHANGE A BASE OTHER THEN 10 TO A BASE OTHER THEN 10 WE HAVE TO CONVERT THE GIVEN NO. INTO DECIMAL AND THEN TO REQUIRED BASE.
Direct Method: for this conversion we follow this rule
In this method we follow the relationship table(binary-octal-hexadeciaml-decimal) and convert the given digit into required base digit.
1. Binary to Octal:
Prepare the binary digit in three three’s pairs. If leftmost group pair has fewer bits then attach required number of leading 0 to become pairs of three. After preparing pairs calculate one octal digit for each group or check the value of binary in octal from the relationship table.
Example: Find 10110011in binary to octal?
10110011 = 010 110 011
010 in binary = 0*1+1*2+0*4 = 2 in Octal
110 in binary = 0*1 + 1*2 + 1*4 = 6 in Octal
011 in binary = Octal 3
So,
010110011 in binary = octal 263

Prove these:
1. 10101.01101 in binary = 25.32 in octal (hint 010 101 . 011 010 )
2. 1101100.111 in binary = 154.7 in octal

2. Octal to Binary:
Convert the Octal digit in binary digit in three three’s pairs from the relationship table or calculate and combined them for required result.
Example: Find 263 in octal to binary
Octal 2 = 010 in binary
Octal 6 = 110 in binary
Octal 3 = 011 in binary
So octal 263 = 010 110 011 = 010110011 in binary
Practice: Prove these:
1. 732.16 in octal = 111011010.001110 in binary
2. 2172.01 in octal = 010001111010.000001 in binary

3. Binary to Hexadecimal:
Prepare the binary digit in Four-Four’s pairs. If leftmost group pair has fewer bits then attach required number of leading 0 to become pairs of four. After preparing pairs calculate one hexadecimal digit for each group or check the value of binary in hexadecimal from the relationship table.

Example:
Change a binary digit 1101110 in hexadecimal form?
1101110 = 0110 1110
0110 in binary = 0*1+1*2+1*4+0*8 = 6 in Hexaadecimal
1110 in binary = 0*1 + 1*2 + 1*4 +1*8= 14 = E in Hexadecimal
So,
1101110 in binary = 6E in hexadecimal

Prove these:
1. 110101.011001 in binary =35.64 in hexadecimal
( hint 0011 0101 . 0110 0100)
2. 100001011.000011 in binary = 10B.0C in hexadecimal

4. Hexadecimal to Binary
Convert the Hexadecimal digit in binary digit in Four Four’s pairs from the relationship table or calculate and combined them for required result.

Example: Find 6E in Hexadecimal to binary
Hexadecimal 6 = 0110 in binary
Hexadecimal E = 14 = 1110 in binary
So
Hexadecimal 6E = 0110 1110 = 1101110 in binary

Example:
1. Convert a binary number 11001 into octal?

Sol:
By indirect method:
Step:1 First convert this given(binary) digit into decimal
11001= 1*1 + 0*2 + 0*4 + 1*8 + 1*16 = 25in decimal
Step:2 Convert step 1’s coming decimal digit into required (octal) digit
25in deciaml = 31 in octal
DIVISION QUOTIENT REMAINDER
25/8 3 1
3/8 0 3

By Direct method:
Given digit------ 11001 = 011001
011 is equivalent to 3
001 is equivalent to 1
So 011 001 in binary
3 1 in octal

Relation between Binary & Octal Number System
Decimal Number Binary Number
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

Practice:
Prove these:
1. 314in base 5 = 1110in base 4
2. 3AB in base 15 = 6A0 in base 11
3. B.F4in hexadecimal = 111001.10100101 in binary



D… CONVERSION FOR FRACTIONAL NUMBER

In fractional nos the decimal point plays a great role, so we have to understand the digits before decimal and after decimal. There are different methods for other base to decimal and decimal to other base.

OTHER BASE TO DECIMAL

Rules: In other base to decimal we will follow these operations on the digits which are :
Before decimal – then (given)base’s power will positive in multiplication method to change in decimal digit.
After Decimal – then change in decimal no., we will put (given base 2/8/16….) base’s power negative starting from -1,-2,-3…… by multiplication method.
…( in base ten also 1.36=1*100 + 3*10-1+6*10-2)

E X . (336.23) 8 = ( ? ) 10
= (3 X 64) +(3 X 8)+(6 X 1)+(2 X 8-1)+(3 X 8-2)
= (222.296875) 10

Practice : Change these numbers in decimal-
1. 1789.16 in hexadecimal to decimal
2. 313.45 in octal
3. Prove : 710.10 in octal =456.125 in decimal
4. Prove: 1001.101in octal = 513.126953 in decimal
5. Prove : 11101101.10101 in binary = 237.65625 in decimal


DECIMAL TO OTHER BASE

Decimal to other base we will follow these operations on the digits which are :
Before decimal – then change decimal digit into required base by division method
After Decimal – change decimal no into required base by multiplication method
• Integer with fractional part
Rules:
1. We multiply given fractional part by 2/8/16(required base) and note the result in separate column.
2. The successive fractional parts of the previous result are multiplied by 2/8/16(required base) till the fractional part of the product become 0 or up to the accuracy.
3. The integer part of the product is written in downward direction to find the binary equivalent of the decimal fraction.

Example;
Change a decimal number 0.68 in octal equivalent?

Process Product decimal part integer part
0.68*8 5.44 .44 5
0.44*8 3.52 .52 3
0.52*8 4.16 .16 4
0.16*8 1.28 .28 1
0.28*8 2.24 .24 2

So, 0.68 in decimal = 0.53412 in octal


E X . (69.75)10= (?) 16

DIVISION QUOTIENT REMAINDER
69/16 4 5
4/16 0 4

AND 0.75 X 16=12 (C)

= (69.75)10= (45.C)16

Practice:
1. prove this (3634.6505)in decimal = (E32.A6872) in hexadecimal
2. Prove this: 493.69 in decimal = 1ED.B0A in hexadecimal
3. Prove : 100.011 in decimal = 1100100.0000001 in binary
4. Prove : 3161.36 in decimal = 6131.2702 in octal
5. Prove 336.36 in decimal 520.2702 in octal

09 September 2010

Manisha, in my memory- for my students and friends.....

Often my Mrs tell me something to share with my students. (I think that,which is she got by mails, magazines or newspapers or......, )


Today, One of them is in front of you,


A blind boy sat on the steps of a building with a hat by his feet. He held up a sign which said: 'I am blind, please help.' There were only a few coins in the hat.

A man was walking by. He took a few coins from his pocket and dropped them into the hat. He then took the sign, turned it around, and wrote some words. He put the sign back so that everyone who walked by would see the new words.

Soon the hat began to fill up. A lot more people were giving money to the blind boy. That afternoon the man who had changed the sign came to see how things were. The boy recognized his footsteps and asked, 'Were you the one who changed my sign this morning? What did you write?'

The man said, 'I only wrote the truth. I said what you said but in a different way.'
What he had written was: 'Today is a beautiful day and I cannot see it.'

Do you think the first sign and the second sign were saying the same thing?

Of course both signs told people the boy was blind. But the first sign simply said the boy was blind. The second sign told people they were so lucky that they were not blind. Should we be surprised that the second sign was more effective?


Now my manisha told me,"say your students - ,
"
Be thankful for what you have.
Be creative.
Be innovative.
Think differently and positively
."

"Invite others towards good with wisdom. Live life with no excuse and love with no regrets. When life gives you a 100 reasons to cry, show life that you have 1000 reasons to smile. Face your past without regret. Handle your present with confidence. Prepare for the future without fear. Keep the faith and drop the fear.

Great men say, 'Life has to be an incessant process of repair and reconstruction, of discarding evil and developing goodness…. In the journey of life, if you want to travel without fear, you must have the ticket of a good conscience.'

The most beautiful thing is to see a person smiling…
And even more beautiful is, knowing that you are the reason behind it!!!

And now today her words are in my memory,If you feel good then say to God ,........".Pl...........give me back my pearl"


May the soul rest in the peace

08 September 2010

O.. God.........Pl Give me back .


M


  • She was the mother of two tiny princes.
  • She was the best cook in my life.
  • She was the trouble shooter of my all problems.
  • She was the best human creature for slaves.
  • She was the sweatiest mom.
  • In her short life anyone who meet ones he/she can't forget her.
  • Now I feels, I am totally addicted with her, I can't survive anymore without her.
  • Most of her life was spent at hospitals and with her parents. with me a very short period..
  • She was the bridge between my community, parents, In-Laws and me....now what???????

.....O.... GOD ..

why you did it................

You have lot of pearls and diamonds ....Pl.........give me back my pearl.......

May the departed soul rest in Peace

30 August 2010

Sad Demise of My "Beloved Wife"

All of u will be shocked to hear about the sad Demise of my Beloved Wife......




"Manisha" "Lukky"

(27-06-82 to 20-08-10)

May the departed soul rest in peace.

19 February 2010

Dear rcert students ,
I am feeling great to receive your love and respect through mails and by orkut. Now if is there any problem regarding academics you are welcome any time. I will try my best to solve as an academic Director.

Vikram

06 February 2010

Query

Students are requested to send their queries (academic) on this blog only, There is no blog of mine related to academic query.
Thanks
In waiting of your queries.........
vikram

07 January 2010

PROGRAM LIST (B.TECH FIRST SEMESTER)

ASIANS INSTITUTE OF TECHNOLOGY

COMPUTER PROGRAMMING & IT

PROGRAM LIST

B.TECH FIRST SEMESTER

1. Write a program to print a “name”.

2. Write a program to calculate an addition of two numbers.

3. Write a program to calculate a area of circle.

4. Write the program to calculate all arithmetic operation.

5. Write a program of swapping of two numbers using three variables.

6. Write a program of swapping of two numbers using two variables.

7. Write a program of conversation [kilometer to meter].

8. Write a program of conversation [hour to minute].

9. Write a program to find a number even or odd.

10. Write a program to find leap year (using if & else).

11. Write the program to find the largest of 3 numbers (using if-else).

12. Write a program of check different colors (using switch).

13. Write a program of print days (using switch).

14. Write a program to read marks of five subject and print Division (if-else).

Percentage division

>=60 First

>=48 & <=59 Second

>=36 & < style="mso-spacerun:yes"> Third

<36 Fail

15. Write a program to check a given character is vowel or not (using switch).

1 6. Write a program to check whether a no. is palindrome or not.

17. Write a program to check whether a no. is prime or not.

18. Write a program to print ‘n’ terms Fibonacci series.

19. Write a program to calculate a table of any number.

20. Write the program to print ‘n’ terms Factorial series.

21. Write a program to reverse a given number.

22. Write a program to read ‘n’ numbers and find out maximum and second maximum value (using array).

23. Write a program to read two 3*3 matrix and add their value and store them in third matrix (using array).

24. Write a program in C to sort a given array of integer numbers.

25. Write a program to read two 3*3 matrix and multiply their value and store them in third matrix (using array).

26. Write a program to read 3*3 matrix and convert it into 4*4 matrix by adding corresponding row and columns.

27. Write a program to read a string and print it in alphabetical order e.g.”SHIVAM” will be printed as “AHIMSV”.

28. Write a program to reverse a string word wise.

29. Write a program to find length, copy, concatenate, compare, and reverse of string using pre-defined function.

30. Write a program to covert lower case string into upper case.

31. Write a program to print a different pattern using loop.

1. * 2. * 3. 1* 2* 3* 4*

* * * * * 1* 2* 3*

* * * * * * * * 1* 2*

* * * * * * * * * * * 1*

4. 10000 5. 1 6. * * * * *

01000 11 * * * *

00100 121 * * *

00010 1331 * *

00001 14641 *

7. 1* 2* 3* 4

1* 2* 3

1* 2

1

32. write a program in C to print the sum of the following series-

x - x3/3! + x5 /5! – x7/7!+………………

33. Write a program to read ‘n’ numbers and add them using pointer.

34. Write a program to create a structure student having student roll no, name and branch. Read information of a student and print it.

35. Write a program to read information of 20 books and print names and author name of those books whose price is more than 500r.

36. Write a program to read a line of text and store it into a file.

37. Write a program to read a text file and count total no of characters and words present in it.

38. Write a program to red a line of text and find out length of the string.

39. Write a program in C to copy contents of a file into another file.

40. Write a program to concatenate 2 strings using pointers. Do not use strcat function.

41. Write a program to create an enumerated data type for 12 months and then print them as integer constants.

42. Write a program to swap two numbers using pointer and function. (call by address mechanism)

28 November 2009

Father of Two Princes

With very pridness i am happy to say that i am father again ...................., got a new prince...........
suggest a good name of Neel's brother.........................

13 November 2009

ADSL

According to Wayne de Nobrega, managing director of Technology Concepts – a company that is delivering one of the most affordable ADSL offerings in the market today – ADSL is simply a far better way to get connected to the Internet. “It’s faster – much faster – than a dial up connection, it is always-on, and although it relies on the same physical cable as your telephone, you can still make and receive calls while online.”

De Nobrega says ADSL works on many of the same principles as a dialup connection. “You will need an ADSL line into your home – which is simply an upgrade to the landline that is probably already installed. Then you will need a special type of modem to connect your computer to the upgraded line; just like the dialup, you will also need an account with an Internet service provider (ISP) – and once you have that in place, you are ready to start surfing the Net at high speed,” he says.

High speed is probably the biggest advantage of ADSL. He compares this connectivity to dialup: “ADSL is always on and doesn’t have any of the annoying modem noises and delays you’ve had to get used to with dialup. With ADSL, you can expect pages to load at least five times faster, even with the entry level ADSL offering,” he says.

The saving in terms of your time is considerable – instead of waiting 15 seconds or longer for each Web page to load, expect it to download in 3 seconds or less. And because you’re always connected, mail trickles down as it arrives, and doesn’t require a big download every time you connect.

Furthermore, with ADSL you don’t pay every time you want to connect to the Internet, as you do with dial up. “So, you can leave your computer connected to the Internet around the clock, with no additional cost. It’s a fixed monthly cost,” de Nobrega adds.

16 September 2009

Linux- Vi editor commands


General Startup
To use vi: vi filename
To exit vi and save changes: ZZ or :wq
To exit vi without saving changes: :q!
To enter vi command mode: [esc]


Counts
A number preceding any vi command tells vi to repeat
that command that many times.
Cursor Movement

h move left (backspace)

j move down

k move up

l move right (spacebar)

[return] move to the beginning of the next line

$ last column on the current line

0 move cursor to the first column on the
current line

^ move cursor to first nonblank column on the
current line

w move to the beginning of the next word or
punctuation mark

W move past the next space

b move to the beginning of the previous word
or punctuation mark

B move to the beginning of the previous word,
ignores punctuation

e end of next word or punctuation mark

E end of next word, ignoring punctuation

H move cursor to the top of the screen

M move cursor to the middle of the screen

L move cursor to the bottom of the screen



Screen Movement

G move to the last line in the file

xG move to line x

z+ move current line to top of screen

z move current line to the middle of screen

z- move current line to the bottom of screen

^F move forward one screen

^B move backward one line

^D move forward one half screen

^U move backward one half screen

^R redraw screen
( does not work with VT100 type terminals )

^L redraw screen
( does not work with Televideo terminals )



Inserting

r replace character under cursor with next
character typed

R keep replacing character until [esc] is hit

i insert before cursor

a append after cursor

A append at end of line

O open line above cursor and enter append mode



Deleting

x delete character under cursor

dd delete line under cursor

dw delete word under cursor

db delete word before cursor



Copying Code

yy (yank)'copies' line which may then be put by
the p(put) command. Precede with a count for
multiple lines.



Put Command
brings back previous deletion or yank of lines,
words, or characters

P bring back before cursor

p bring back after cursor


Find Commands

? finds a word going backwards

/ finds a word going forwards

f finds a character on the line under the
cursor going forward

F finds a character on the line under the
cursor going backwards

t find a character on the current line going
forward and stop one character before it

T find a character on the current line going
backward and stop one character before it

; repeat last f, F, t, T



Miscellaneous Commands

. repeat last command

u undoes last command issued

U undoes all commands on one line

xp deletes first character and inserts after
second (swap)

J join current line with the next line

^G display current line number

% if at one parenthesis, will jump to its mate

mx mark current line with character x

'x find line marked with character x

NOTE: Marks are internal and not written to the file.



Line Editor Mode
Any commands form the line editor ex can be issued
upon entering line mode.

To enter: type ':'

To exit: press[return] or [esc]



ex Commands
For a complete list consult the
UNIX Programmer's Manual



READING FILES
copies (reads) filename after cursor in file
currently editing

:r filename



WRITE FILE

:w saves the current file without quitting



MOVING

:# move to line #

:$ move to last line of file



SHELL ESCAPE
executes 'cmd' as a shell command.

:!'cmd'


LINUX COMMANDS
#1: top
I figured it was fitting to put the top command at the top. Although top is actually responsible for listing currently running tasks, it is also the first command Linux users turn to when they need to know what is using their memory (or even how much memory a system has). I often leave the top tool running on my desktop so I can keep track of what is going on at all times. Sometimes, I will even open up a terminal (usually aterm), place the window where I want it, and then hide the border of the window. Without a border, the terminal can’t be moved, so I always have quick access to the information I need.
Top is a real-time reporting system, so as a process changes, it will immediately be reflected in the terminal window. Top does have some helpful arguments (such as the -p argument, which will have top monitor only user-specified PIDs), but running default, top will give you all the information you need on running tasks.
#2: ln
To many administrators, links are an invaluable tool that not only make users lives simpler but also drastically reduce disk space usage. If you are unaware of how links can help you, let me pose this simple scenario: You have a number of users who have to access a large directory (filled with large files) on a drive throughout the day. The users are all on the same system, and you don’t want to have to copy the entire directory to each user’s ~/ directory. Instead, just create a link in each user’s ~/ directory to the target. You won’t consume space, and the users will have quick access. Of course when spanning drives, you will have to use symlinks. Another outstanding use for links is linking various directories to the Apache doc root directory. Not only can this save space, it’s often advantageous from a security standpoint.
#3: tar/zip/gzip
Tar, zip, and gzip are archival/compression tools that make your administrator life far easier. I bundle these together because the tools can handle similar tasks yet do so with distinct differences (just not different enough to warrant their own entry in this article). Without these tools, installing from source would be less than easy. Without tar/zip/gzip, creating backups would require more space than you might often have.
One of the least used (but often most handy) features of these tools is the ability to extract single files from an archive. Now zip and gzip handle this more easily than tar. With tar, to extract a single file, you have to know the exact size of the file to be extracted. One area where tar/zip/gzip make administration simple is in creating shells scripts that automate a backup process. All three tools can be used with shell scripts and are, hands down, the best, most reliable backup tools you will find.
#4: nano, vi, emacs
I wasn’t about to place just one text editor here, for fear of stoking the fires of the “vi vs. emacs” war. To top that off, I figured it was best to throw my favorite editor — nano — into the mix. Many people would argue that these aren’t so much commands as they are full-blown applications. But all these tools are used within the command line, so I call them “commands.” Without a good text editor, administering a Linux machine can become problematic.
Imagine having to attempt to edit /etc/fstab or /etc/samba/smb.conf with OpenOffice. Some might say this shouldn’t be a problem, but OpenOffice tends to add hidden end-of-line characters to text files, which can really fubar a configuration file. For the editing of configuration or bash files, the only way to go is with an editor such as nano, vi, or emacs.
#5: grep
Many people overlook this amazingly useful tool. Grep prints lines that match a user-specified pattern. Say, for instance, that you are looking at an httpd.conf file that’s more than 1,000 lines long, and you are searching for the “AccessFileName .htaccess” entry. You could comb through that file only to come across the entry at line 429, or you can issue the command grep -n “AccessFileName .htaccess” /etc/httpd/conf/http.conf. Upon issuing this command you will be returned “439:AccessFileName .htaccess” which tells you the entry you are looking for is on, surprise of all surprises, line 439.
The grep command is also useful for piping other commands to. An example of this is using grep with the ps command (which takes a snapshot of current running processes.) Suppose you want to know the PID of the currently crashed Firefox browser. You could issue ps aux and search through the entire output for the Firefox entry. Or you could issue the command ps aux|grep firefox, at which point you might see something like this:
jlwallen 17475 0.0 0.1 3604 1180 ? Ss 10:54 0:00 /bin/sh /home/jwallen/firefox/firefoxjlwallen 17478 0.0 0.1 3660 1276 ? S 10:54 0:00 /bin/sh /home/jlwallen/firefox/run-mozilla.sh /home/jlwallen/firefox/firefox-bin

jlwallen 17484 11.0 10.7 227504 97104 ? Sl 10:54 11:50 /home/jlwallenfirefox/firefox-bin

jlwallen 17987 0.0 0.0 3112 736 pts/0 R+ 12:42 0:00 grep --color firefox
Now you know the PIDs of every Firefox command running.
#6: chmod
Permissions anyone? Linux administration and security would be a tough job without the help of chmod. Imagine not being able to make a shell script executable with chmod u+x filename. Of course it’s not just about making a file executable. Many Web tools require certain permissions before they will even install. To this end, the command chmod -R 666 DIRECTORY/ is one very misused command. Many new users, when faced with permissions issues trying to install an application, will jump immediately to 666 instead of figuring out exactly what permissions a directory or folder should have.
Even though this tool is critical for administration, it should be studied before jumping in blindly. Make sure you understand the ins and outs of chmod before using it at will. Remember w=write, r=read, and x=execute. Also remember UGO or User, Group, and Other. UGO is a simple way to remember which permissions belong to whom. So permission rw- rw- rw- means User, Group, and Other all have read and write permissions. It is always best to keep Other highly restricted in their permissions.
#7: dmesg
Call me old-school if you want, but any time I plug a device into a Linux machine, the first thing I do is run the dmesg command. This command displays the messages from the kernel buffer. So, yeah, this is an important one. There is a lot of information to be garnered from the dmesg command. You can find out system architecture, gpu, network device, kernel boot options used, RAM totals, etc.
A nice trick is to pipe dmesg to tail to watch any message that comes to dmesg. To do this, issue the command dmesg | tail -f and the last few lines of dmesg will remain in your terminal. Every time a new entry arrives it will be at the bottom of the “tail.” Keep this window open when doing heavy duty system administration or debugging a system.
#8: kill/killall
One of the greatest benefits of Linux is its stability. But that stability doesn’t always apply to applications outside the kernel. Some applications can actually lock up. And when they do, you want to be able to get rid of them. The quickest way to get rid of locked up applications is with the kill/killall command. The difference between the two commands is that kill requires the PID (process ID number) and killall requires only the executable name.
Let’s say Firefox has locked up. To kill it with the kill command you would first need to locate the PID using the command ps aux|grep firefox command. Once you got the PID, you would issue kill PID (Where PID is the actual PID number). If you didn’t want to go through finding out the PID, you could issue the command killall firefox (although in some instances it will require killall firefox-bin). Of course, kill/killall do not apply (nor should apply) to daemons like Apache, Samba, etc.
#9: man
How many times have you seen “RTFM”? Many would say that acronym stands for “Read the Fine* Manual” (*This word is open for variation not suitable for publication.) In my opinion, it stands for “Read the Fine Manpage.” Manpages are there for a reason — to help you understand how to use a command. Manpages are generally written with the same format, so once you gain an understanding of the format, you will be able to read (and understand) them all. And don’t underestimate the value of the manpage. Even if you can’t completely grasp the information given, you can always scroll down to find out what each command argument does. And the best part of using manpages is that when someone says “RTFM” you can say I have “RTFMd.”
#10: mount/umount
Without these two commands, using removable media or adding external drives wouldn’t happen. The mount/umount command is used to mount a drive (often labeled like /dev/sda) to a directory in the Linux file structure. Both mount and umount take advantage of the /etc/fstab file, which makes using mount/umount much easier. For instance, if there is an entry in the /etc/fstab file for /dev/sda1 that maps it to /data, that drive can be mounted with the command mount /data. Typically mount/umount must have root privileges (unless fstab has an entry allowing standard users to mount and unmount the device). You can also issue the mount command without arguments and you will see all drives that are currently mounted and where they’re mapped to (as well as the type of file system and the permissions).
cat
cat [options] [files]
Read (concatenate) one or more files and print them on standard output. Read standard input if no files are specified or if - is specified as one of the files; input ends with EOF. You can use the > operator to combine several files into a new file, or >> to append files to an existing file. When appending to an existing file, use Ctrl-D, the end-of-file symbol, to end the session.
Options
-A, --show-all
Same as -vET.
-b, --number-nonblank
Number all nonblank output lines, starting with 1.
-e
Same as -vE.
-E, --show-ends
Print $ at the end of each line.
-n, --number
Number all output lines, starting with 1.
-s, --squeeze-blank
Squeeze down multiple blank lines to one blank line.
-t
Same as -vT.
-T, --show-tabs
Print TAB characters as ^I.
-u
Ignored; retained for Unix compatibility.
-v, --show-nonprinting
Display control and nonprinting characters, with the exception of LINEFEED and TAB.
Examples
cat ch1 Display a file cat ch1 ch2 ch3 > all Combine files cat note5 >> notes Append to a file cat > temp1 Create file at terminal. To exit, enter EOF (Ctrl-D). cat > temp2 << STOP Create file at terminal. To exit, enter STOP.

Source and courtesy of Google

12 September 2009

changed DMS into OOPS in IIIrd semester in RTU

3CS4 OBJECT ORIENTED PROGRAMMING (Common to Comp. Engg. & Info. Tech)
Units Contents of the subject

Introduction: Review of structures in C, accessing members of structures using
structure variables, pointer to structures, passing structures to functions, structures as user defined data types.
II
Introduction to programming paradigms- (Process oriented and Object oriented).
Concept of object, class, objects as variables of class data type, difference in
structures and class in terms of access to members, private and public members of a class, data & function members. Characteristics of OOP- Data hiding, Encapsulation, data security. Basics of C++: Structure of C++ programs, introduction to defining member functions within and outside a class, keyword using, declaring class, creating objects, constructors & destructor functions, Initializing member values with and without use of constructors, simple programs to access & manipulate data members, cin and cout functions. Dangers of returning reference to a private data member, constant objects and members function, composition of classes, friend functions and classes, using this pointer, creating and destroying objects dynamically using new and delete operators. Static class members, container classes and iterators, proxy classes.
III
Operator overloading: Fundamentals, Restrictions, operator functions as class
members v/s as friend functions. Overloading stream function, binary operators and
unary operators. Converting between types.
IV
Inheritance: Base classes and derived classes, protected members, relationship
between base class and derived classes, constructors and destructors in derived
classes, public, private and protected inheritance, relationship among objects in an
inheritance hierarchy, abstract classes, virtual functions and dynamic binding, virtual
destructors.
V
Multiple inheritance, virtual base classes, pointers to classes and class members,
multiple class members. Templates, exception handling.

<span style="font-style:italic;">3CS7 PROGRAMMING IN C++ (Common to Comp. Engg. & Info. Tech)
S. No. List of Experiments

1
To write a simple program for understanding of C++ program structure without any
CLASS declaration. Program may be based on simple input output, understanding of
keyword using.
2
Write a C++ program to demonstrate concept of declaration of class with public &
private member, constructors, object creation using constructors, access restrictions,
defining member functions within and outside a class. Scope resolution operators,
accessing an object’s data members and functions through different type of object
handle name of object, reference to object, pointer to object, assigning class objects
to each other.
3
Program involving multiple classes (without inheritance) to accomplish a task.
Demonstrate composition of class.
4 Demonstration Friend function friend classes and this pointer.
5
Demonstration dynamic memory management using new & delete & static class
members.
6
Demonstration of restrictions an operator overloading, operator functions as member
function and/ or friend function, overloading stream insertion and stream extraction,
operators, overloading operators etc.
7
Demonstrator use of protected members, public & private protected classes, multilevel
inheritance etc.
8
Demonstrating multiple inheritance, virtual functions, virtual base classes, abstract
classes