Find sum of series 1+2+8+26+80+…….+n

we can not define 1+2+8+26+80+.......... series in a simple manner to write  program. But..... 2,8,26,80,242.................can be define as below The way to discover the next term is multiply the next number by 2 and then add it on. i.e. the next number of 2 is 3 so, 3*2=6+2=8 9*2=18+8=26 27*2=54+26=80........ and so on             OR … Continue reading Find sum of series 1+2+8+26+80+…….+n

Advertisements

While and Do-While loop in Java with example

In this tutorial we will discuss while loop and do while loop. Java while Loop A while loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true. The syntax of while loop is: while (Expression) { // codes inside body of while loop } How while … Continue reading While and Do-While loop in Java with example

The Java Buzzwords

The key considerations were summed up by the Java team in the following list of buzzwords: Simple Secure Portable Object-oriented Robust Multi-threaded Architecture-neutral Interpreted High performance Distributed and Dynamic simple – Java is designed to be easy for the professional programmer to learn and use. object-oriented: a clean, usable, pragmatic approach to objects, not restricted … Continue reading The Java Buzzwords

Algorithm paradigm | Introduction to Divide and conquer algorithm

Divide and conquer algorithm Divide and conquer (D&C) is an algorithm design paradigm based on multi-branched recursion. A divide and conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined … Continue reading Algorithm paradigm | Introduction to Divide and conquer algorithm

Java program to find LCM of given array

Least Common Multiple (LCM) of two numbers is the smallest number which can be divided by both numbers. or The smallest positive number that is a multiple of two or more numbers. Let's start with an Example ... List the multiples of each number, Least Common Multiple (LCM) of 15 and 20: The multiples of … Continue reading Java program to find LCM of given array

Java program to find LCM of two numbers

Least Common Multiple (LCM) of two numbers is the smallest number which can be divided by both numbers. or The smallest positive number that is a multiple of two or more numbers. Let's start with an Example ... List the multiples of each number, Least Common Multiple (LCM) of 15 and 20: The multiples of … Continue reading Java program to find LCM of two numbers

Switch Statement in Java

A switch statement tests a variable for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each case. Syntax: switch (expression) { case value1 : //Statements break; //optional case value2 : //Statements break; //optional //You can have any number of case statements. default … Continue reading Switch Statement in Java

Conditional Statement in Java|set 2

Nested if Statements: You can use one if-else statement inside another if or else statement. For example: int age = 36; if(age > 1) { if(age > 20) { System.out.println("Welcome to HelloTech!"); } else { System.out.println("You are too Young"); } } else { System.out.println("Error"); } //Outputs "Welcome to HelloTech!" You can nest as many if-else … Continue reading Conditional Statement in Java|set 2