#include<stdio.h>
void bins(int lb,int ub,int item,int a[]);
void main()
{
int i,n,item,a[20];
printf("Enter the size of an array: ");
scanf("%d",&n);
printf("Enter the elements of the array: " );
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("Enter the number to be search: ");
scanf("%d",&item);
bins(0,n-1,item,a);
}
void bins(int lb,int ub,int item,int a[])
{
int mid,flag=0;
if(lb<=ub)
{
mid=(lb+ub)/2;
if(item==a[mid])
{
flag=flag+1;
}
else if(item<a[mid])
{
return bins(lb,mid-1,item,a);
}
else
return bins(mid+1,ub,item,a);
}
if(flag==0)
printf("Number is not found.");
else
printf("Number is found at %d", mid+1);
}
Thursday, November 27, 2014
Using the concept of Inheritance write a C++ Program to calculate the area and perimeter of rectangle
Sumit Kar November 27, 2014 C++ Programming, CPP No comments
/* C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. */ #includeusing namespace std; class Rectangle { protected: float length, breadth; public: Rectangle(): length(0.0), breadth(0.0) { cout<<"Enter length: "; cin>>length; cout<<"Enter breadth: "; cin>>breadth; } }; /* Area class is derived from base class Rectangle. */ class Area : public Rectangle { public: float calc() { return length*breadth; } }; /* Perimeter class is derived from base class Rectangle. */ class Perimeter : public Rectangle { public: float calc() { return 2*(length+breadth); } }; int main() { cout<<"Enter data for first rectangle to find area.\n"; Area a; cout<<"Area = "<
Sunday, November 23, 2014
Java Program to implement Thread
class A extends
Thread
{
public void
run( )
{
for( int i = 1 ;
i <= 5 ; i++
)
System.out.println( " From thread A : i
= " +
i ) ;
System.out.println( " End of thread
A "
) ;
}
}
class B extends
Thread
{
public void
run( )
{
for( int j = 1 ;
j <= 5 ; j++ )
System.out.println( "
From thread B : j = "
+ j );
System.out.println( "
End of thread B " ) ;
}
}
class C extends
Thread
{
public void
run( )
{
for( int
k = 1 ; k
<= 5 ; k++
)
System.out.println( "
From thread C : k =
" + k );
System.out.println( "
End of thread C " ) ;
}
}
class ThreadTest
{
public static
void main ( String
args[ ] )
{
A obA
= new A( ) ; //
new born state
obA.start(
) ; //
runnable state
new B( ).start( );
new C( ).start( );
System.out.println( "
End of main thread " ) ;
}
}
Friday, November 21, 2014
8085 Programming : store the nos in a memory loc. In the reverse order in another memory location
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

MVI C, 0AH ; Initialize counter
LXI H, 2200H ; Initialize source memory pointer
LXI D, 2309H ; Initialize destination memory pointer
BACK: MOV A, M ; Get byte from source memory block
STAX D ; Store byte in the destination memory block
INX H ; Increment source memory pointer
DCX D ; Decrement destination memory pointer
DCR C ; Decrement counter
JNZ BACK ; If counter 0 repeat
HLT ; Terminate program execution
8085 Programming : In a set of nos add only the odd nos
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

LDA 2200H
MOV C, A ; Initialize counter
LXI H, 2201H ; Initialize pointer
MVI E, 00 ; Sumlow = 0
MOV D, E ; Sumhigh = 0
BACK: MOV A, M ; Get the number
ANI 01H ; Mask Bit1 to Bit7
JZ SKIP ; Do not add if number is even
MOV A, E ; Get the lower byte of sum
ADD M ; Sum = sum + data
MOV E, A JNC SKIP ; Store result in E register
INR D ; Add carry to MSB of SUM
SKIP: INX H ; Increment pointer
DCR C ; Decrement counter
JNZ BACK ; Check if counter 0 repeat
MOV A, E
STA 2300H ; Store lower byte
MOV A, D
STA 2301H ; Store higher byte
HLT ; Terminate program execution
8085 Programming : In a set of nos add only the even nos
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

LDA 2200H
MOV C, A ; Initialize counter
MVI B, 00H ; sum = 0
LXI H, 2201H ; Initialize pointer
BACK: MOV A, M ; Get the number
ANI, 01H ; Mask Bit1 to Bit7
JNZ SKIP ; Don’t add if number is ODD
MOV A, B ; Get the sum
ADD M ; SUM = SUM + data
MOV B, A ; Store result in B register
SKIP: INX H ; increment pointer
DCR C ; Decrement counter
JNZ BACK ; if counter 0 repeat
STA 2210H ; store sum
HLT ; Terminate program execution
8085 Programming : To find the no of 1’s in the byte
Sumit Kar November 21, 2014 8085, Assembly Programming No comments
8085 Programming : Block data transfer
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

MVI C, 0AH ; Initialize counter
LXI H, 2200H ; Initialize source memory pointer
LXI D, 2300H ; Initialize destination memory pointer
BACK: MOV A, M ; Get byte from source memory block
STAX D ; Store byte in the destination memory block
INX H ; Increment source memory pointer
INX D ; Increment destination memory pointer
DCR C ; Decrement counter
JNZ BACK ; If counter 0 repeat
HLT ; Terminate program execution
8085 Programming : Adding 2 Hexa-Decimal nos with carry
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

LDA 2200H
MOV C,A ; Initialize counter
LXI H, 2201H ; Initialize pointer
SUB A ; Sum low = 0
MOV B,A ; Sumhigh = 0
BACK: ADD M ; Sum = sum + data
JNC SKIP
INR B ; Add carry to MSB of SUM
SKIP: INX H ; Increment pointer
DCR C ; Decrement counter
JNZ BACK ; Check if counter 0 repeat
STA 2300H
MOV A,B ; Store lower byte
STA 2301H ; Store higher byte
HLT ; Terminate program execution
8085 Programming : Adding 2 Hexa-decimal nos without carry
Sumit Kar November 21, 2014 8085, Assembly Programming No comments
8085 Programming: Adding 2 BCD nos without carry
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

MOV A, L ; Get lower 2 digits of no. 1
ADD E ; Add two lower digits
DAA ; Adjust result to valid BCD
STA 2300H ; Store partial result
MOV A, H ; Get most significant 2 digits of no. 2
ADC D ; Add two most significant digits
DAA ; Adjust result to valid BCD
STA 2301H ; Store partial result
HLT ; Terminate program execution
8085 Programming : ADDITION OF 16BIT NUMBERS
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

ADDITION OF TWO 16BIT NUMBERS SUM 16 BITS OR MORE
Manually strore 1st 16 bit no in the memory location C050 & C051 in reverse order
Manually store 2nd 16 bit no in the memory location C052 & C053 in reverse order
Result is stored in C053, C054 & C055 in reverse order
LHLD C050
XCHG
LHLD C052
MVI C,00
DAD D
JNC AHEAD
INR C
AHEAD: SHLD C054
MOV A,C
STA C056
HLT
EXAMPLE-> A645+9B23=014168
STORE-> C050=45,C051=A6,C052=23,C053=9B
Answer-> C054=68,C055=41,C056=01
// 45H,A6H,23H,9BH
8085 Programming : 8 BIT DECIMAL SUBSTRACTION
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

If 2nd no is greater than 1st no then the answer will in 2's complement
Manually strore 1st 8 bit no in the memory location C050
Manually store 2nd 8 bit no in the memory location C051
Result is stored in C052
LXI H,C051
MVI A,99
SUB M
INR A
DCX H
ADD M
DAA
STA C052
HLT
EXAMPLE-> 99-48=51
STORE-> C050=99,C051=48
OUTPUT:
C052=51
8085 Programming: Exchange the contents of memory locations
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

Exchange the contents of memory locations 2000H and 4000H.
Program 1:
LDA 2000H : Get the contents of memory location 2000H into accumulator
MOV B, A : Save the contents into B register
LDA 4000H : Get the contents of memory location 4000H into accumulator
STA 2000H : Store the contents of accumulator at address 2000H
MOV A, B : Get the saved contents back into A register
STA 4000H : Store the contents of accumulator at address 4000H
Program 2:
LXI H 2000H : Initialize HL register pair as a pointer to memory location 2000H.
LXI D 4000H : Initialize DE register pair as a pointer to memory location 4000H.
MOV B, M : Get the contents of memory location 2000H into B register.
LDAX D : Get the contents of memory location 4000H into A register.
MOV M, A : Store the contents of A register into memory location 2000H.
MOV A, B : Copy the contents of B register into accumulator.
STAX D : Store the contents of A register into memory location 4000H.
HLT : Terminate program execution.
Note: In Program 1, direct addressing instructions are used, whereas in Program 2, indirect addressing instructions are used.
8085 Programming: Store 8 bit data in Memory
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

Program 1:
MVI A, 52H : Store 32H in the accumulator
STA 4000H : Copy accumulator contents at address 4000H
HLT : Terminate program execution
Program 2:
LXI H : Load HL with 4000H
MVI M : Store 32H in memory location pointed by HL register pair (4000H)
HLT : Terminate program execution
Note: The result of both programs will be the same. In program 1 direct addressing instruction is used, whereas in program 2 indirect addressing instruction is used.
8085 Programming: 8 BIT MULTIPLICATION: PRODUCT 16-BIT
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

LHLD 2501
XCHG
LDA 2503
LXI H,0000
MVI C,08
LOOP: DAD H
RAL
JNC AHEAD
DAD D
AHEAD: DCR C
JNZ LOOP
SHLD 2504
HLT
LSB OF MULTIPLICAND - 84H, MSB OF MULTIPLICAND - 00H ,MULTIPLIER - 56H
ANSWER
AT ADDRESS 2504 - 58H, LSBs OF PRODUCT
AT ADDRESS 2505 - 2CH, MSB sOF PRODUCT
8085 Programming: 8 BIT DIVISION
Sumit Kar November 21, 2014 8085, Assembly Programming No comments

LHLD 2501
LDA 2503
MOV B,A
MVI C,08
LOOP: DAD H
MOV A,H
SUB B
JC AHEAD
MOV H,A
INR L
AHEAD: DCR C
JNZ LOOP
SHLD 2504
HLT
INPUT:
LSB OF DIVIDEND - 9BH, MSB OF DIVIDEND - 48H , DIVISOR - 1AH
ANSWER
AT ADDRESS 2504 - F2H, QUOTIENT
AT ADDRESS 2505 - 07H, REMAINDER
8085 Programming: 2's COMPLEMENT OF AN 8-BIT NUMBER
Sumit Kar November 21, 2014 8085, Assembly Programming No comments
8085 Programming: 2's COMPLEMENT OF A 16-BIT NUMBER
Sumit Kar November 21, 2014 8085, Assembly Programming No comments
8085 Programming: 1's COMPLEMENT OF AN 8-BIT NUMBER
Sumit Kar November 21, 2014 8085, Assembly Programming No comments
Thursday, November 20, 2014
Nokia's first device to the post Microsoft era
Sumit Kar November 20, 2014 Android, Microsoft, Nokia, Technology No comments
Nokia isn't exactly known for its tablets, but having sold its phone-making division to Microsoft it's hoping to catch your eye with its latest compellingly priced Android offering. The Nokia N1 starts at $250 and is set to go on sale in China before the Chinese New Year -- that's February 19, 2015. Information on other international pricing and release dates have yet to be announced, but the US dollar price converts to around £160 or AU$290.
The N1 looks trendy and slim. It's 6.9mm thick and an aluminum frame that comes in dark gray or silver. Its 7.9-inch IPS LCD screen boasts a 4:3 aspect ratio with a 2,048x1,536-pixel resolution. Inside you'll find a 64-bit 2.3GHz Intel Atom Z3580 CPU and PowerVR G6430 GPU with 2GB RAM.
In a somewhat unusual move, the Nokia N1 houses a whopping 32GB of internal storage. Initially this sounds impressive, until you realise it can't be expanded. Nonetheless, some manufactures have the gall to leave you with a lot less and no microSD card slot, so it's a satisfactory trade-off. That amount of space can accommodate a large number of apps, movies and games.
The Nokia N1 is one of the first tablets to sport a USB Type-C socket, which is a reversible USB port that's set to replace all types of USB connections. It's not the sexiest cutting-edge feature, but it's useful future-proofing.
The N1 is also the first to sport Nokia's Android launcher, Z Launcher. Running on top of the latest version of Google's operating system, Lollipop 5.0, the Z Launcher simplifies the home screen with a gridlike display of apps. It customizes the look of the home screen according to where you are, what time it is and what you're doing, as well as making adjustments geared toward your typical activities.
If you want to try out this user interface before you buy the N1, Nokia invites you to download it from Google Play and install it on your current Android tablet or phone.
Source: CNET
WhatsApp add new features to Group Chat : Multiple Admins
Sumit Kar November 20, 2014 Android, Technology, WhatsApp, Windows No comments

The new Group Chat feature in WhatsApp lets you chat with up to 100 people at once. Previously it was only 50. It is a great way stay in touch with your family, friends and colleagues. Specially for people with larger number of peers, like students in a class or in a big office, it is now easy to add all the people as members of the group. In addition to the change in number of people you can add to a group, there are a few more changes :
- Every group has one or more admins. Only admins can add or remove participants. Previously you had only one admin for a group.
- Now you can see the Received and Read receipt for all the members of the group, even if they have set privacy option.
Other things you must know about Group Chats are:
- There is no limit to the number of groups you can create.
- Only admins can make other participants admins.
- If the last admin leaves the group, a new admin will be randomly assigned.
- You can always control your own participation in a Group Chat, by staying in or leaving the group when you wish. Remember that only group admins have the ability to add participants. If you have any questions about being added to a group, or prefer not to be added, please speak to a group admin.
- If you have blocked a contact, you will still receive messages this contact sends into any group you have in common. Likewise, they will still receive messages you send to those groups.
Firefox dumps Google, signs with Yahoo as default search engine
Sumit Kar November 20, 2014 Firefox, Google, Technology, Yahoo No comments
Yahoo will replace Google as the default search engine on the Firefox web browser in the US, signalling Yahoo’s resolve to regain some of the ground that it has lost in the most lucrative part of the internet’s ad market.
The five-year alliance announced on Wednesday will end a decade-old partnership in the US between Google and the Mozilla Foundation, which oversees the Firefox browser. The tensions between Google and Mozilla had been rising since Google’s introduction of the Chrome browser in 2008 began to undercut Firefox. Google’s contract with Mozilla expires at the end of November.
Even though Chrome is now more widely used, Firefox still has a loyal audience that makes more than 100bn search requests annually worldwide.
Besides dropping Google in the US, Mozilla is also shifting Firefox to the Baidu search engine in China and to Yandex in Russia. Firefox users still have the option to pull down a tab to pick Google and other search engines as their preferred way for looking up information online.
Yahoo is hoping to impress Firefox users as the company sets out to prove it is still adept at internet search after leaning on Microsoft’s technology for most of the results on Yahoo’s own website for four years.
Financial details of Yahoo’s Firefox contract were not disclosed. In a blogpost, Chris Beard, the Mozilla chief executive, said the new deal offered “strong, improved economic terms” while allowing Mozilla “to innovate and advance our mission in ways that best serve our users and the web”.
Google accounted for 90% or about $274m (£175m) of Mozilla’s royalty revenue in 2012. Mozilla has not released its annual report for last year.
Yahoo plans to unveil a “clean and modern” search engine on Firefox next month and roll out the new model on its own website early next year, according to its chief executive, Marissa Mayer.
The redesign will primarily affect how Yahoo’s search engine’s results are displayed and not the way that requests are processed. The search technology will continue to be provided by Microsoft as part of a 10-year deal Yahoo signed in 2009.