Skip to content

Instantly share code, notes, and snippets.

View achchuthany's full-sized avatar
🎯
Focusing

Yogarajah Achchuthan achchuthany

🎯
Focusing
View GitHub Profile
"""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)
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;
}
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);
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;
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++) {
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) {
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();
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++){
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;
public interface Stack {
public boolean isEmpty();
public Object pop();
public Object peek();
public void push(Object TheElement);
}