Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~219 People Reached
Favorite Forums
Favorite Tags
java x 3
Member Avatar for sujoy98

/* l=first index r=last index */ import java.util.Scanner; public class BinarySearch{ public static void main(String[]args){ int a[]={1,2,3,4,5,6,7,8,9,10}; Scanner sc=new Scanner(System.in); System.out.print("Enter a data to search :"); int data=sc.nextInt(); int l=0,r=a.length-1; while(l<r){ int mid=(l+r)/2; if(data==a[mid]){ System.out.println("data found at "+mid+"th index."); break; }else if(data<a[mid]){ r=mid-1; }else{ l=mid+1; } mid=(l+r)/2; if(data!=a[mid]){ System.out.print("not found"); …

Member Avatar for rproffitt
0
22
Member Avatar for sujoy98

import java.util.Scanner; class bank{ public void termDeposit(){ int principle; double rate,years; Scanner sc=new Scanner(System.in); System.out.print("Enter Principle Amount : "); principle = sc.nextInt(); System.out.print("Enter rate od interest : "); rate = sc.nextDouble(); System.out.print("Enter time period in years : "); years = sc.nextDouble(); double maturityAmount = (principle*(Math.pow(1+(rate/100),years))); System.out.println("Maturity Amount after " +years+ …

Member Avatar for sujoy98
0
193