Category: Computer organization and architecture

Computer organization and architecture program in java

Full Adder program in java

Full Adder program in java

import java.util.*; class FULLADDER { public static void main(String args[]) { int a[],b[]; Scanner sc=new Scanner(System.in); System.out.println(“ENTER NUMBER OF BITS : “); int n=sc.nextInt(); a=new int[n]; b=new int[n]; System.out.println(“ENTER ELEMENTS : \nA CONTAINS:”); for(int...

bankers algorithm program in java

bankers algorithm program in java

import java.util.*; class Bankers { int claim[][],alloc[][],av[],need[],p,r,alsum[],sum,temp[][]; int a=0,b=0,c; boolean flag; Scanner src = new Scanner(System.in); Bankers(int p,int r) { this.p=p; this.r=r; claim=new int[p][r]; alloc=new int[p][r]; av=new int [r]; need=new int [r]; alsum=new int[r];...

Booths Algorithm program in java

Booths Algorithm program in java

import java.util.*; class BOOTH { public static int[] add(int a[],int m1[]) { int carry=0; int sum[]=new int [4]; for(int i=3;i>=0;i–) { sum[i]=(a[i]+m1[i]+carry)%2; carry=(a[i]+m1[i]+carry)/2; } return sum; } public static void shift(int a[],int q[]) {...

RESTORING Division program in java

RESTORING Division program in java

import java.util.*; class RESTORING { public static void lshift(int a[],int q[]) { for(int i=0;i<3;i++) { a[i]=a[i+1]; } a[3]=q[0]; for(int i=0;i<3;i++) { q[i]=q[i+1]; } q[3]=0; } public static int[] add(int a[],int m1[]) { int carry...