Thursday, August 29, 2024

Python Program to Check if a Number is Odd or Even

Python Program to Check if a Number is Odd or Even;


num = int(input("Enter a number: "))

if (num % 2) == 0:

   print("{0} is Even".format(num))

else:

   print("{0} is Odd".format(num))

8085 PRACTICAL

1. Program name :A=07H,B=08H,A=A+B.Find the content of A and B.

2. Program name : B=10,C=12,D=B+C.Find the content of D.

3. Program name:B=(200) BASE 10,C=B’(1’s complement of B).Find the content of C.

4. Program name :D=(200)10,C=2’s complement of D.Find the content of C.

5. Program name :D=-1,B=+1,C=B+D.Find the content of C.

6. Program name :D=55H,E=56H,C=D-E.Find the content of C.

7. Program name :D=55H,E=56H,H=D-E using 2’s complement addition.Find the content of H.

8. Program name :B=20H,C=30H,Swap B & C.Find the content of B & C.

9. Program name :Swap the content of 5000H and 3000H.

10. Program name :3000H=data1,4000H=2’s complement of data1.Find the content of 4000H.

11. Program name :3000H=data1,3001H=data2,3002H=data1+data2.Find the content of

3002H.

12. Program name :3000H=data1,3001H=data2,3002H=data3,3003H=data1+data2+data3.

Find the content of 3003H.

13. Program name :3000H=data1,3001H=data2,3002H=data1+data2,3003H=data1-data2.

Find the content of 3002H and 3003H.

14. Program name :A=20H.Add data byte 30H with immediate Acc with carry 1.

15. Program name :A=20H.Add data byte 30H with immediate Acc with carry 0.

16. Program name : A=20H,B=30H.Add register B to Acc with carry 1.

17. Program name :A=20H,B=30H.Add register B to Acc with carry 0.

18. Program name :A=20H.Add the data byte 30H immediate to Acc .Find the content of Acc

after execution

19. Program name :A=FFH,B=88H,data byte=11H.C=11H AND Acc,D=C AND B.Find the

content of C and D.

20. Program name :A=FFH,B=88H,Data byte=11H.C=11H OR Acc,D=C OR B.Find the content

of C and D.

21. Program name :A=FFH,B=88H,Data byte=11H.C=11H XOR Acc,D=C XOR B.Find the

content of C and D.

22. Program name :1st law of DeMorgan’s Theorem:(A+B)’=A’.B’.C=LHS & D=RHS.When

A=01H & B=00H,then find the content of C and D.

23. Program name :2nd law of DeMorgan’s Theorem:(A.B)’=A’+B’.C=(A.B)’ & D=A’+B’.When

A=01H & B=00H,then find the content of C and D.

24. Program name :Acc=10H,B=20H;A=Acc+B (Using Jmp instruction).

25. Program name :A=0AH.After RAL(Rotate Acc Left) move the result in C.Find the content of

C.

26. Program name :A=0AH & Carry=1.After RAL(Rotate Acc Left) move the result in C.Find the

content of C.

27. Program name :Input a number in C register & then multiply with 4 & save it into D

register.Find the content of D.

28. Program name :16 bit addition.4000H=Data 1(L),4001H=Data 1(H),4002H=Data 2(L),

4003H=Data 2(H).4004H=Sum(L),4005H=Sum(H).Find the contents of 4004H & 4005H.


29. Program name :Sum(16 bit) of two 8 bit datas.4000H=data 1,4001H=data 2,

4002H=Sum(L),4003H=Sum(H).Find the content of 4002H & 4003H.


30. Program name :4000H=data 1.If data 1 is even no.,then D=00H,otherwise D=01H.


31. Program name :4000H=data 1.If data 1 is even no.,then D=00H,otherwise D=01H.Do it

using If-else.


32. Program name :5000H=data 1.If data 1 is +ve,then store 5001H with FFH,otherwise store

with 00H.


33. Program name :1+2+3+.....+10(using loop)


34. Program name :1+2+3+.....+100.Result=8 bit.Store the result in D register.Find the content

of D.


35. Program name :1+2+3+.....+50.Result=8 bit.Store the result in D register.Find the

result(content of D).


36. Program name :1+2+3+...+100=Sum of series=16 bit.D=Sum(H),E=Sum(L).Find the

content of D and E.


37. Program name :2500H=data 1,2501H=data 2,2502H=data 3,25003H=data 4.

3000H=Sum(H),3001H=Sum(L).Find the content of 3000H and 3001H.


38. Program name :3000H=data.If no. is even positive,then store FFH in D register,but if it is

even negative,then store FFH in E register.


39. Program name :3000H=data.If no. is even positive,store 3001H with AAH,if even

negative,then store 3001H with BBH,if odd positive,store 3001H with CCH,if odd negative,then

store 3001H with DDH.


40. Program name :3001H=data 1,3001H=data 2,3002H=data 3,3003H=data 4.3004H=total

number of even number,3005H=total number of odd number.Find the content of 3004H &

3005H.


41. Program name :3000H=data 1,3001H=data 2,3002H=data 3,3003H=data 4.4000H=even

positive,4001H=even negative,4002H=odd positive,4003H=odd negative.


42. Program name :Memory Implementattion


43. Program name :5000H=11H,5001H=22H,5002H=Sum(8 bit).Find the content of 5003H.


44. Program name :Sum of 10 numbers,result=8 bit,starting memory location is

5000H.5000H=data 1,5001H=data 2,........,5009H=data 10.


45. Program name :Sum of 10 numbers,result=16 bit,starting location=5000H.

6000H=(sum)lower , 6001H=(sum)upper.Find the content of 6000H & 6001H.


46. Program name :Sum of n numbers(n=11),A=result=8 bit,starting location=5000H.Find A.


47. Program name :Sum of n no.,result=16bit.6000H=(sum)upper, 6001H=(sum)lower


48. Program name :HL=5000H,DE=3000H.Exchange HL & DE.


49. Program name :Block transfer(10 data).3000H=data 1,3001H=data 2,...3009H=data

10.result will be 5000H=data 1 of 3000H,.......5009H=data 10 of 3009H.


50. Program name :B=22H,C=22H.Compare B & C register,if B=C,then D=FFH,otherwise

D=00H.


51. Program name :LINEAR SEARCH:Count the total number of 0 from an array of n-bit.


52. Program name :Count the total number of FFH from an array of n-bit.


53. Program name :Count the total number of even number & odd number (using memory).


54. Program name :Input a no. from memory location 3000H & convert it into ASCII & save it in

4000H.


55. Program name :Input-->3000H=data 1...Output-->4000H=(a)0 for invalid no. , (b)1for valid

no.....4001H=(a)00 for invalid no., (b)ASCII for valid no.


56. Program name :INPUT-->4000H=data 1,4001H=data 2,4002H=data3

.OUTPUT-->5000H=largest number.Find the content of 5000H.


57. Program name :BINARY TO GRAY CODE:--Input a number from 3000H & convert the no.

into gray code & store it in 4000H.


58. Program name :MULTIPLICATION USING REPEATED ADDITION(4 bit*4bit =8bit):------

5*3=15.


59. Program name :MULTIPLICATION USING REPEATATIVE ADDITION(8bit *8bit = 16bit):-

10H * 11H.[(16)10*(17)10]


60. Program name :Count the total number of 1 of 8 bit number.


61. Program name :Count the total number of 0 &1 of a 8bit number.


62. Program name :Palindrome checking:-Input-->3000H=data.Output-->4000H=00H if not

palindrome,otherwise store FFH.


63. Program name :Seperate 2 nibbles:--3000H=10100111(A7H).4000H=upper

nibble=00001010 , 4001H=lower nibble=00000111.


64. Program name :3000H=data.4000H=FFH if two nibbles are equal,otherwise store 00H.


65. Program name :3000H=data.,right shift 4 times,then store the output in 4000H.Find the

content of 4000H.


66. Program name :BCD to binary:-data=00100110=26H(BCD)=38(binary).Convert the binary

number into 26H.


67. Program name :MULTIPLICATION USING ADD & SHIFT METHOD:

Input-->3000H=multiplicant,3001H=multiplier.Output-->3002H=upper part of product

,3003H=lower part of the product.


68. Program name :DIVISION USING REPEATATIVE SUBTRACTION:I/P->D=0BH(dividend),

E=03H(divider)..Output-->B=Quotient , D=Remainder.Find out the contents of B & D.


69. Program name : Replace all 0’s with FF in the array.


70. Program name :Count the total no. of element which is greater than 55H.


71. Program name :Add content of two memory location.


72. Program name :Sub two 16-bit no.,result 16 bit.


73. Program name :8-bit data shift left,1 bit.


74. Program name :8-bit data shift right,1 bit.


75. Program name :Largest number of n-numbers.


76. Program name :Smallest number of n- numbers.


77. Program name :Gray to binary conversion.


78. Program name :Ascending order sorting(using bubble sort)


79. Program name :Descending order sorting(using bubble sort).


80. Program name :Place the content of the memory location FC50 in register B & that of

FC51 in register C.The content of FC50 & FC51 are 11H &12H respectively.


81. Program name :Place 05 in the Acc,increment it by one & store the result in the memory

location FC50H.


82. Program name :Add two 8-bit decimal number,result 16 bit.


83. Program name :8-bit decimal subtraction.


84. Program name :1’s complement of a 16-bit number.


85. Program name :2’s complement of a 16-bit number.


86. Program name :8-bit data shift left,2bit.


87. Program name :16-bit data shift left,1-bit.


88. Program name :16-bit data shift left,2-bit.


89. Program name :Find the square from look-up table.


90. Program name :Find the larger of 2 number.


91. Program name :Smallest of 2 numbers.


92. Program name :Sum of a series of 8-bit decimal number,result 16-bit.


93. Program name :Multibyte addition.


94. Program name :Multibyte decimal addition.


95. Program name :Sum of a series of multibyte decimal number.


96. Program name :Seperate the odd and even numbers from an array of 5 numbers.


97. Program name :Move a block of 10 data stored from F101H to FI0AH to a target location

from F020H to F029H in the reverse order in which they are actually stored.


98. Program name :Memory bloack transfer in overlapping order.


99. Program name :Add an array of 3 16-bit hex. No. and subtract 48H.


100. Program name :Fibonacci series.


101. Program name :Fibonacci series upto n-no. Which are greater than 0AH and smaller

than 1EH.Output stored from F100 → 0D,15.


102. Program name :Factorial of a number.












































8085

 1. 8085 THEORY

2. 8085 PRACTICAL CLICK

3. 8085 question set (Gaonkar)  CLICK

4. 8085 op code CLICK

5. 8085 assignment CLICK


Monday, July 29, 2024

add graphics.h in DEV C/C++

 

step 1: 

download files:


https://drive.google.com/file/d/1ULN_XcrbDkls2U2DlYkNM_yiua5h-_NI/view?pli=1



step 2:

Copy libbgi.a to the lib folder of Dev C++. The default location is C:\Program Files (x86)\Dev-Cpp\MinGW64\lib.


step 3: 

Copy graphics.h and winbgim.h to the include folder of Dev C++. The default location is C:\Program Files (x86)\Dev-Cpp\MinGW64\include.


step4 :

Open Dev C++ and go to Tools -> Compiler Options. Select the Parameters tab and check the box for “Add the following commands when calling the linker”.

In the linker text area, paste the following commands:


-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32


. These are the required linkers for graphics.h file.



step 5:


 #include<graphics.h>  

#include<conio.h>  

#include<stdio.h>  

int main()  

{  

    int gd = DETECT ,gm, i;  

    float x, y,dx,dy,steps;  

    int x0, x1, y0, y1;  

    initgraph(&gd, &gm, "C:\\TC\\BGI");  

    setbkcolor(WHITE);  

    x0 = 100 , y0 = 200, x1 = 500, y1 = 300;  

    dx = (float)(x1 - x0);  

    dy = (float)(y1 - y0);  

    if(dx>=dy)  

           {  

        steps = dx;  

    }  

    else  

           {  

        steps = dy;  

    }  

    dx = dx/steps;  

    dy = dy/steps;  

    x = x0;  

    y = y0;  

    i = 1;  

    while(i<= steps)  

    {  

        putpixel(x, y, RED);  

        x += dx;  

        y += dy;  

        i=i+1;  

    }  

    getch();  

    closegraph();  

}  

//ADVERTISEMENT


output>





Friday, June 28, 2024

LINK LIST

 

1. Insert element  at the front. -algorithm

2. Insert element  at the end. -algorithm

3. Insert element  at any position. -algorithm

4. Delete element  from the front. -algorithm

5. Delete element  from the end. -algorithm

6. Delete element  from any position-algorithm

7. Count Node-Algorithm

8. Advantages And Disadvantages

9. Comapre with array

 

doubly link list

1. Insert element  at the front. -algorithm

2. Insert element  at the end. -algorithm

3. Insert element  at any position. -algorithm

4. Delete element  from the front. -algorithm

5. Delete element  from the end. -algorithm

6. Delete element  from any position-algorithm

7. Swap Two Adjacent Element-Algorithm

 

Circular Link List

1. Insert Element  At The Front. -Algorithm

2. Insert Element  At The End. -Algorithm

3. Insert Element  At Any Position. -Algorithm

4. Delete Element  From The Front. -Algorithm

5. Delete Element  From The End. -Algorithm

6. Delete Element  From Any Position-Algorithm

 

 

Stack Using Link List-Algorithm

Queue Using Link List-Algorithm

Sparse Matrix Using Link List

Polynomial Using Link List

Polynomial Add, Subtract, Multiplication -Algorithm

 

 

QUEUE

 

1. Insertion,Deletion,Display Algorithm

2. Double Queue In A Single Array

3. Stack using queue

4.Queue using stack

 

Circular queue

1. Overflow Underflow Condition

2. Insertion, Deletion, Display Algorithm

 

Dqueue

1. Overflow Underflow Condition

2. Insertion, Deletion, Display Algorithm

 

Priority Queue

1. Definition,Example

2. Insertion, Deletion, Display Algorithm

 

Stack

 

1. push/pop/display/peek - algorithm

2. stack Application

3.infix,prefix,postfix

4.infix to prefix  - algorithm

5.infix to postfix - algorithm

6.prefix evaluation- algorithm

7.postfix evaluation- algorithm

8.double stack in a single array- algorithm

Array

 



1. Insert element  at the front.-Algorithm

2. Insert element  at the end.-Algorithm

3. Insert element  at any position.-Algorithm

4. Delete element  from the front.-Algorithm

5. Delete element  from the end.-Algorithm

6. Delete element  from any position-Algorithm

7.Address calculation

8.Advantages,Disadvantages


 

2D Array

1. Row major / Column major address calculation

 

 

Sparse matrix

Upper triangular/Lower triangular matrix

 


DATA STRUCTURE ALL ALGORITHM NEP SYLLABUS

 ARRAY: click

STACK: click

QUEUE: click

LINK LIST: click

TREE:

HASHING:

SEARCHING AND SORTING :

Tuesday, March 5, 2024

C program practice set:






15.Sum of digits :—CLICK

16.

17. 1!+2!+3!+...n :—CLICK

18.1!-2!+3!-4!+...n :—CLICK

19. a+a²+a³+a⁴+a⁵... :—CLICK

20. a-a²+a³-a⁴... :—CLICK

21. (a/1)+(a²/2)+(a³/3)+(a⁴/4)+... :—

22. (a/1!)+(a²/2!)+(a³/3!)+(a⁴/4!)+... :—CLICK

23.a-(a²/2!)+(a³/3!)-(a⁴/4!)... :—CLICK

24. a+(a³/3!)+(a⁵/5!)+... :—CLICK

25. (a²/2!)+(a⁴/4!)+(a⁶/6!)+... :—CLICK

26. Sum of digits :—CLICK

27. 

28. Armstrong number checking :—CLICK

29. Print all factors of a number :—CLICK

30.Count total number of factors :—CLICK

31.Prime number checking :—CLICK

32.Sum of all factors :—CLICK

33. Perfect number checking :—  CLICK

34. Count total numbers of 0 in a number :—CLICK

35. Sum of all odd digits :—CLICK

36. Sum of all odd position and even position digits :—CLICK

37. Decimal to Binary :—CLICK

38. Binary to Decimal :—CLICK

39. Decimal to Octal :—CLICK

40. Octal to Decimal :—CLICK

41. Sum an average of n numbers :—CLICK

42. Program of a^b :—CLICK HERE

43. Input a number and check it is divisible by 3 or not :—CLICK

44. Input a number and check it is divisible by 3 or divisible by 5 or divisible by both or divisible by none :— CLICK

45. Input a salary and increament 10% salary :— CLICK


46. Pattern  

“11111

  22222

  33333

  44444”