This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | """Write a program that uses a for loop to print the numbers 8, 11, 14, 17, 20, . . . , 83, 86, 89.""" | |
| for i in range(8,90,3): | |
| print(i) | |
| """Write a program that uses a for loop to print the numbers 100, 98, 96, . . . , 4, 2.""" | |
| for i in range(100,1,-2): | |
| print(i) | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class FibonacciSeries { | |
| public static void main(String[] args) { | |
| int n = 50, term1 = 0, term2 = 1; | |
| System.out.print("Fibonacci Series up-to " + n + " : "); | |
| while (term1 <= n) { | |
| System.out.print(term1 + " "); | |
| int sum = term1 + term2; | |
| term1 = term2; | |
| term2 = sum; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class MaxMin { | |
| int[] array; | |
| int max, min; | |
| public MaxMin(int n) { | |
| //create array with size n | |
| array = new int[n]; | |
| //assign random value into the array | |
| for (int i = 0; i < n; i++) { | |
| array[i] = (int) Math.round(Math.random() * 12 + 26); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class BinarySearchRec { | |
| int[] array = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}; | |
| public int binarySearch(int key, int l, int r) { | |
| if (r < l) { | |
| return -1; | |
| } | |
| int mid = (l + r) / 2; | |
| if (key == array[mid]) { | |
| return mid; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class QuickSort { | |
| int array[]; | |
| int size; | |
| public QuickSort(int n) { | |
| size = n; | |
| //create array with size n+1 | |
| array = new int[n + 1]; | |
| //asign value into the array | |
| for (int i = 0; i < n; i++) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.util.Scanner; | |
| public class AgeCalculator { | |
| int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
| int month_l[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
| String id; | |
| int d, m, y; | |
| public static boolean isLeapYear(int y) { | |
| if (y % 100 == 0) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package org.achchuthan.java.core; | |
| import java.util.Scanner; | |
| public class Decimal2Binary { | |
| public static void main(String args[]) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.print("Enter Decimal Number : "); | |
| int num = input.nextInt(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class MergeSort { | |
| int array[]; | |
| int size; | |
| public MergeSort(int n) { | |
| size=n; | |
| //create array with size n | |
| array=new int[n]; | |
| //asign value into the array | |
| for (int i=0;i<n;i++){ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class BinarySearch { | |
| int[] array = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}; | |
| public int search(int key) { | |
| int l = 0; | |
| int r = array.length - 1; | |
| while (l <= r) { | |
| int mid = (l + r) / 2; | |
| if (key == array[mid]) { | |
| return mid; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public interface Stack { | |
| public boolean isEmpty(); | |
| public Object pop(); | |
| public Object peek(); | |
| public void push(Object TheElement); | |
| } | 
NewerOlder