Knowledge in Machine learning

Thoughtful machine learning

This is a popular book on machine learning

computer and programming

what is computer and programing explained here in brief.

Java programs to print integers from 1 to 10

class Integers {   public static void main(String[] arguments) {     int c; //declaring a variable   /* Using for loop to repeat instruction execution */     for (c = 1; c <= 10; c++) {       System.out.println(c);     }   } }

Java If Else Condition

class Condition {   public static void main(String[] args) {     boolean learning = true;     if (learning) {       System.out.println("Java programmer");     }     else {       System.out.println("What are you doing here?");     }   } }

Java print command line arguments

class Arguments {   public static void main(String[] args) {     for (String t: args) {       System.out.println(t);     }   } }

Java program to compare strings

import java.util.Scanner; class CompareStrings {    public static void main(String args[])    {       String s1, s2;       Scanner in = new Scanner(System.in);             System.out.println("Enter the first string");       s1 = in.nextLine();             System.out.println("Enter the second string");       s2 = in.nextLine();             if (s1.compareTo(s2) > 0)          System.out.println("The first string is greater than the second.");       else if (s1.compareTo(s2) < 0)          System.out.println("The first string is smaller than the second.");       else            System.out.println("Both the strings are equal.");    } }

Java program to print alphabets

class Alphabets {    public static void main(String args[])    {       char ch;       for (ch = 'a'; ch <= 'z'; ch++)          System.out.println(ch);    } }

Java program to convert Celsius to Fahrenheit

import java.util.*; class FahrenheitToCelsius {   public static void main(String[] args) {     float temperature;     Scanner in = new Scanner(System.in);     System.out.println("Enter temperature in Fahrenheit");     temperature = in.nextInt();     temperature = ((temperature - 32)*5)/9;     System.out.println("temperature in Celsius = " + temperature);   } }

Java program to print the largest of the 3 numbers

import java.util.Scanner; class Largest {   public static void main(String args[])   {     int x, y, z;     System.out.println("Enter three integers");     Scanner in = new Scanner(System.in);     x = in.nextInt();     y = in.nextInt();     z = in.nextInt();     if (x > y && x > z)       System.out.println("First number is largest.");     else if (y > x && y > z)       System.out.println("Second number is largest.");     else if (z > x && z > y)       System.out.println("Third number is largest.");     else       System.out.println("The numbers are not distinct.");   } }

Java program for enhanced for loop

class EnhancedForLoop {   public static void main(String[] args) {     int primes[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29};     for (int t: primes) {       System.out.println(t);     }   } }

Java program to reverse string

import java.util.*; class ReverseString {    public static void main(String args[])    {       String original, reverse = "";       Scanner in = new Scanner(System.in);             System.out.println("Enter a string to reverse");       original = in.nextLine();             int length = original.length();             for (int i = length - 1 ; i >= 0 ; i--)          reverse = reverse + original.charAt(i);                 System.out.println("Reverse of the string: " + reverse);    }

Binary search in Java

import java.util.Scanner; class BinarySearch {   public static void main(String args[])   {     int c, first, last, middle, n, search, array[];     Scanner in = new Scanner(System.in);     System.out.println("Enter number of elements");     n = in.nextInt();     array = new int[n];     System.out.println("Enter " + n + " integers");     for (c = 0; c < n; c++)       array[c] = in.nextInt();     System.out.println("Enter value to find");     search = in.nextInt();     first  = 0;     last   = n - 1;     middle = (first + last)/2;     while( first <= last )     {       if ( array[middle] < search )         first = middle + 1;           else if ( array[middle] == search )       {         System.out.println(search + " found at location " + (middle + 1) + ".");         break;       }       else          last = middle - 1;       middle = (first + last)/2;    }    if (first > last)       System.out.println(search + " isn't present in the list.\n");   } }