Find out your Body Mass Index
Here are the Screen Shots of the Application :
This app is developed in C# programming language and the software used to develop is C# 2010 Express
CLICK HERE to Download.
1: public class Search {
2:
3: public static void main(String args[]){
4: int array[] = {1,5,9,11,25,90,122};
5: int key = 122;
6:
7: Search.LinearSearch(array,key);
8: }
9:
10: public static void LinearSearch(int array[],int key){
11: int last = array.length-1;
12:
13: for(int i = 0; i < array.length;i++){
14: if(array[i] == key){
15: System.out.println("The key found at index : "+i);
16: return;
17: }else if(i == last)
18: System.out.println("Not in the Array");
19: else System.out.println("Searching.....");
20: }//loop
21:
22: }//method
23:
24: }
25:
1: public class Search {
2:
3: public static void main(String args[]){
4: int array[] = {1,5,9,11,25,90,122};
5: int key = 122;
6:
7: Search.BinarySearch(array,key);
8: }
9:
10: public static void BinarySearch(int array[],int key){
11: int last = array.length-1;
12: int first = 0,mid = (first+last)/2;
13:
14: for(int i = 0; first <= last;i++){
15: mid = (first+last)/2;
16: if(array[mid] == key){
17: System.out.println("The key found at index : "+mid);
18: return;
19: }else if(array[mid] > key)
20: last = mid - 1;
21:
22: else if(array[mid] < key)
23: first = mid + 1;
24: else if(i == array.length-1)
25: System.out.println("Not in the Array!!!");
26: System.out.println("Searching......");
27: }//loop
28:
29: }//method
30:
31: }