<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AmalaReegan</title>
    <description>The latest articles on DEV Community by AmalaReegan (@reegan).</description>
    <link>https://dev.to/reegan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2502751%2F30b31638-b473-4275-ad54-a4ee265973d8.jpeg</url>
      <title>DEV Community: AmalaReegan</title>
      <link>https://dev.to/reegan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/reegan"/>
    <language>en</language>
    <item>
      <title>Day 28-Factorial Number:</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Mon, 31 Mar 2025 11:40:11 +0000</pubDate>
      <link>https://dev.to/reegan/day-28-factorial-number-3fmf</link>
      <guid>https://dev.to/reegan/day-28-factorial-number-3fmf</guid>
      <description>&lt;h2&gt;
  
  
  Factorial:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnblylcdmv4uz129hfh2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnblylcdmv4uz129hfh2d.png" alt="Image description" width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package day1;

import java.util.Scanner;
public class Factorial
{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.println("Enter the factorial number");
int n=scan.nextInt();
long Factorial=1;
for(int i=1; i&amp;lt;=n; i++)
{
Factorial=Factorial*i;
}
System.out.println(Factorial);
}
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7lck96j0wui3xotngzv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7lck96j0wui3xotngzv2.png" alt="Image description" width="800" height="139"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Day 27-Java collections:</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Wed, 26 Mar 2025 03:12:41 +0000</pubDate>
      <link>https://dev.to/reegan/day-27-java-collections-58cg</link>
      <guid>https://dev.to/reegan/day-27-java-collections-58cg</guid>
      <description>&lt;h2&gt;
  
  
  Collections of java:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Java Collections are a framework that provides a set of classes and interfaces to store and manipulate data in Java. &lt;/p&gt;

&lt;p&gt;==&amp;gt; The Java Collections Framework is a part of the java.util package and is designed to handle groups of objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  There are two main types of collections in Java:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Collection Interface &lt;br&gt;
 ==&amp;gt; Map Interface&lt;/p&gt;

&lt;h2&gt;
  
  
  1.Collection Interface:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  List:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; An ordered collection that can contain duplicate elements.&lt;/p&gt;

&lt;p&gt;ArrayList:&lt;/p&gt;

&lt;p&gt;==&amp;gt; A dynamic array that grows as needed. Elements can be accessed by index.&lt;/p&gt;

&lt;p&gt;LinkedList:&lt;/p&gt;

&lt;p&gt;==&amp;gt; Doubly linked list. It allows for fast insertions/deletions at both ends but is slower for random access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; A collection that does not allow duplicates.&lt;/p&gt;

&lt;p&gt;HashSet: &lt;/p&gt;

&lt;p&gt;==&amp;gt; No duplicates and does not maintain any order.&lt;/p&gt;

&lt;p&gt;LinkedHashSet: &lt;/p&gt;

&lt;p&gt;==&amp;gt; No duplicates, but it maintains insertion order.&lt;/p&gt;

&lt;p&gt;TreeSet: &lt;/p&gt;

&lt;p&gt;==&amp;gt; No duplicates, and it orders elements according to their natural ordering or a comparator.&lt;/p&gt;

&lt;h2&gt;
  
  
  Queue:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; A collection used for holding elements prior to processing.&lt;/p&gt;

&lt;p&gt;PriorityQueue: &lt;/p&gt;

&lt;p&gt;==&amp;gt; A queue where elements are processed in order of their priority.&lt;/p&gt;

&lt;p&gt;LinkedList: &lt;/p&gt;

&lt;p&gt;==&amp;gt; Implements both List and Queue interfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.Map Interface
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; This is not a true collection but a structure that holds key-value pairs, where each key maps to exactly one value.&lt;/p&gt;

&lt;p&gt;HashMap:&lt;/p&gt;

&lt;p&gt;==&amp;gt; A map that does not maintain any order of keys.&lt;/p&gt;

&lt;p&gt;LinkedHashMap: &lt;/p&gt;

&lt;p&gt;==&amp;gt; A map that maintains the insertion order of keys.&lt;/p&gt;

&lt;p&gt;TreeMap: &lt;/p&gt;

&lt;p&gt;==&amp;gt; A map that maintains keys in sorted order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.*;

public class CollectionExample {
    public static void main(String[] args) {

        // List Example (Allow Duplicates)
        List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();
        list.add("Java");
        list.add("Python");
        list.add("Java");
        System.out.println("List: " + list);

        // Set Example (No Duplicates)
        Set&amp;lt;String&amp;gt; set = new HashSet&amp;lt;&amp;gt;();
        set.add("Java");
        set.add("C++");
        set.add("Java");
        System.out.println("Set (No Duplicates): " + set);

        // Map Example (Key-Value pairs)
        Map&amp;lt;String, Integer&amp;gt; map = new HashMap&amp;lt;&amp;gt;();
        map.put("Java", 8);
        map.put("Python", 3);
        map.put("JavaScript", 6);
        System.out.println("Map: " + map);

        // Queue Example
        Queue&amp;lt;String&amp;gt; queue = new LinkedList&amp;lt;&amp;gt;();
        queue.add("First");
        queue.add("Second");
        queue.add("Third");
        System.out.println("Queue: " + queue);
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List: [Java, Python, Java]
Set (No Duplicates): [Java, C++]
Map: {Java=8, Python=3, JavaScript=6}
Queue: [First, Second, Third]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Day26.1 - Searching in java: Binary search</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Mon, 24 Feb 2025 18:26:45 +0000</pubDate>
      <link>https://dev.to/reegan/day261-searching-in-java-binary-search-2lh9</link>
      <guid>https://dev.to/reegan/day261-searching-in-java-binary-search-2lh9</guid>
      <description>&lt;h2&gt;
  
  
  Binary Search:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Definition:
&lt;/h2&gt;

&lt;p&gt;Binary search oru efficient algorithm,ithu sorted array la oru element ah thedura method.Divide and conquer approach use pannum  athu search range ah rendu panga pirichu (half ah divide pannitu) check pannum.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time Complexity:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Best case:
&lt;/h2&gt;

&lt;p&gt;O(1) — target middle la irundha first check la kandupidichurum &lt;/p&gt;

&lt;h2&gt;
  
  
  Worst and Average case:
&lt;/h2&gt;

&lt;p&gt;O(log n) — because every time, search space ah half pannitu pogum. Adhan logarithmic time complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Condition:
&lt;/h2&gt;

&lt;p&gt;Array must be sorted — Binary search unsorted arrays la work agadhu!So,ascending or descending order la irukkanum data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Definition:
&lt;/h2&gt;

&lt;p&gt;Middle element ah check panni,target smaller ah irundha left side la pogum,target bigger ah irundha right side la pogum ippadi half half ah split pannitu search pannum. &lt;/p&gt;

&lt;h2&gt;
  
  
  Example Program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class Binarysearch {
public static void main(String[] args) 
{

// TODO Auto-generated method stub

int[]arr={10,15,20,25,30,35,40,45}; 
         //0 ,1 ,2 ,3 ,4 ,5 ,6 ,7

int key=40;
int min_index=0;
int max_index=arr.length-1;
while(min_index&amp;lt;=max_index)
{
int mid_index=(min_index+max_index)/2;  //3
if(arr[mid_index]==key)
{
System.out.println("key is presented in "+ mid_index);
break;
}
else if (key&amp;gt;arr[mid_index]) //3
{
min_index = mid_index+1;   //3+1=4
//System.out.println("key is presented in "+min_index);
}
else if(key&amp;gt;arr[mid_index]) 
{
min_index = mid_index -1;
System.out.println("key is presented in "+min_index);
}
}
}
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jul1ajiol814f3xkpaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jul1ajiol814f3xkpaz.png" alt="Image description" width="800" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day26 - Searching in java: (Linear Search or (Sequential Search in Java)</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Mon, 24 Feb 2025 08:46:07 +0000</pubDate>
      <link>https://dev.to/reegan/day26-searching-in-java-linear-search-sequential-search-in-java-5ah3</link>
      <guid>https://dev.to/reegan/day26-searching-in-java-linear-search-sequential-search-in-java-5ah3</guid>
      <description>&lt;h2&gt;
  
  
  searching in java:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; In Java,searching refers to the process of finding an element in a data structure like an array,list,or map. &lt;/p&gt;

&lt;p&gt;==&amp;gt; Let’s break down the main types of searching techniques:&lt;/p&gt;

&lt;h2&gt;
  
  
  Linear Search (Sequential Search):
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Definition:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Linear search is a simple search algorithm where each element is checked one by one until the target is found or the end of the array is reached.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time Complexity:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Best case:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; O(1) — if the target is at the first index.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worst case:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; O(n) — if the target is at the last index or not found.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use case:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Works well for small or unsorted datasets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example program:(While loop)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class Linearsearch {

public static void main(String[] args) {
// TODO Auto-generated method stub

int[] arr= {10,15,8,11,55,67,7}; //0 1 2 3 4 5 6
int key=7;
int ke=8;
int i=0;

while(true)   //looping  // while(i&amp;lt;arr.length)  
{
if(arr[i]==key)   // if condition
{
System.out.println("key is presented:"+""+i);  //print statement
break;
}

if(arr[i]==ke)    // if condition
{
System.out.println("ke is presented:"+""+i);  //print statement
//break;
}
i++;
}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv1dapmd2na248i87l76d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv1dapmd2na248i87l76d.png" alt="Image description" width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Ex program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class Linearsearch1 {
public static void main(String[] args) {

// TODO Auto-generated method stub

int[] arr= {10,15,8,11,55,67,7}; //0 1 2 3 4 5 6
int key=7;
if(arr[0]==key)

{
System.out.println("key is presented"+" "+ 0);  //print statement

}
if (arr[1]==key)
{
System.out.println("key is presented"+" "+ 1);
}
if (arr[2]==key)
{
System.out.println("key is presented"+" "+ 2);
}
if (arr[3]==key)
{
System.out.println("key is presented"+" "+ 3);
}
if (arr[4]==key)
{
System.out.println("key is presented"+" "+ 4);
}
if (arr[5]==key)
{
System.out.println("key is presented"+" "+ 5);
}
if (arr[6]==key)
{
System.out.println("key is presented"+" "+ 6);
}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9zuvmwsj3rq99jzhfatf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9zuvmwsj3rq99jzhfatf.png" alt="Image description" width="800" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day25</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Mon, 24 Feb 2025 07:04:22 +0000</pubDate>
      <link>https://dev.to/reegan/day25-4fp</link>
      <guid>https://dev.to/reegan/day25-4fp</guid>
      <description></description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Day24-Scanner Class in Java</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Wed, 19 Feb 2025 04:25:37 +0000</pubDate>
      <link>https://dev.to/reegan/day24-scanner-class-in-java-4plc</link>
      <guid>https://dev.to/reegan/day24-scanner-class-in-java-4plc</guid>
      <description>&lt;h2&gt;
  
  
  Scanner Class in Java:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Scanner is a class in java.util package used for obtaining the input of the primitive types like int, double,and strings.&lt;/p&gt;

&lt;p&gt;==&amp;gt; Using the Scanner class in Java is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

import java.util.Scanner; // Import Scanner class

public class ScannerClass {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

// Taking String input
System.out.print("Enter your name: ");
String name = scanner.nextLine();

// Taking integer input
System.out.print("Enter your age: ");
int age = scanner.nextInt();

// Displaying input values
System.out.println("Hello, " + name + "! You are " + age + " years old.");

    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs1wq3zuzimeyog2cwmyg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs1wq3zuzimeyog2cwmyg.png" alt="Image description" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day23</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Wed, 19 Feb 2025 04:17:41 +0000</pubDate>
      <link>https://dev.to/reegan/day23-o8o</link>
      <guid>https://dev.to/reegan/day23-o8o</guid>
      <description></description>
    </item>
    <item>
      <title>Day22</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Wed, 19 Feb 2025 04:17:23 +0000</pubDate>
      <link>https://dev.to/reegan/day22-4kdc</link>
      <guid>https://dev.to/reegan/day22-4kdc</guid>
      <description></description>
    </item>
    <item>
      <title>Day21</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Wed, 19 Feb 2025 04:16:29 +0000</pubDate>
      <link>https://dev.to/reegan/day22-1h4d</link>
      <guid>https://dev.to/reegan/day22-1h4d</guid>
      <description></description>
    </item>
    <item>
      <title>Day20:Quotient And Remainder in Java;</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Wed, 12 Feb 2025 18:06:19 +0000</pubDate>
      <link>https://dev.to/reegan/day20quotient-and-remainder-in-java-2486</link>
      <guid>https://dev.to/reegan/day20quotient-and-remainder-in-java-2486</guid>
      <description>&lt;h2&gt;
  
  
  Quotient And Remainder:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; The remainder is the integer left over after dividing one integer by another. The quotient is the quantity produced by the division of two numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  For example:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; (7/2) = 3 In the above expression 7 is divided by 2, so the quotient is 3 and the remainder is 1.&lt;/p&gt;

&lt;h2&gt;
  
  
  Approach:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Divide the dividend by the divisor using / operator. Both dividend and divisor can be of any type except string, the result will also be computed accordingly.&lt;/p&gt;

&lt;p&gt;==&amp;gt; Get the remainder using % operator. Expressions used in program to calculate quotient and remainder:&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class Remainder {

   public static void main(String[] args) 
  {
    // TODO Auto-generated method stub

   int dividend = 555, divisor = 10;
   while (dividend &amp;gt; 4) {
   int remainder = dividend % divisor;
   System.out.println("The Remainder is = "+ remainder);
   // Reduce the dividend by removing the last digit
   dividend=dividend/divisor;
  }
  }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The Remainder is = 5
The Remainder is = 5
The Remainder is = 5

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Day19:Number Series</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Tue, 11 Feb 2025 04:36:42 +0000</pubDate>
      <link>https://dev.to/reegan/day19number-series-ng8</link>
      <guid>https://dev.to/reegan/day19number-series-ng8</guid>
      <description>&lt;h2&gt;
  
  
  Task1:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1 . Look at this series: 58, 52, 46, 40, 34,28 ... What number should come next?
&lt;/h2&gt;

&lt;p&gt;24&lt;/p&gt;

&lt;p&gt;26&lt;/p&gt;

&lt;p&gt;25&lt;/p&gt;

&lt;p&gt;22&lt;/p&gt;

&lt;h2&gt;
  
  
  Ans:
&lt;/h2&gt;

&lt;p&gt;The series is decreasing by 6 each time:&lt;/p&gt;

&lt;p&gt;58-6=52&lt;br&gt;
52-6=46&lt;br&gt;
46-6=40&lt;br&gt;
40-6=34&lt;br&gt;
34-6=28&lt;/p&gt;

&lt;p&gt;So, continuing the pattern,28-6=22.&lt;br&gt;
The next number in the series is 22.&lt;/p&gt;

&lt;h2&gt;
  
  
  Program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class number {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int num=58;
        int count=1;
        while(count&amp;lt;=7) {
            System.out.println(num);
            num=num-6;
            count=count+1;
        }


    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;58
52
46
40
34
28
22

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Look at this series: 3, 4, 7, 8, 11, 12,15,16,19 ... What number should come next?&lt;/p&gt;

&lt;p&gt;17&lt;/p&gt;

&lt;p&gt;20&lt;/p&gt;

&lt;p&gt;21&lt;/p&gt;

&lt;p&gt;19&lt;/p&gt;

&lt;h2&gt;
  
  
  Ans:
&lt;/h2&gt;

&lt;p&gt;Let’s look at the pattern:&lt;br&gt;
3-&amp;gt;4 (add1)&lt;br&gt;
4-&amp;gt;7 (add3)&lt;br&gt;
7-&amp;gt;8 (add1)&lt;br&gt;
8-&amp;gt;11(add3)&lt;br&gt;
11-&amp;gt;12(add1)&lt;br&gt;
12-&amp;gt;15(add3)&lt;br&gt;
15-&amp;gt;16(add1)&lt;br&gt;
16-&amp;gt;19(add3)&lt;/p&gt;

&lt;p&gt;It looks like the pattern alternates between adding 1 and adding &lt;/p&gt;

&lt;p&gt;Following this pattern, the next step is to add 3 to 12, so:&lt;/p&gt;

&lt;p&gt;19+1=20&lt;/p&gt;

&lt;p&gt;The next number in the series is 20.&lt;/p&gt;

&lt;h2&gt;
  
  
  Program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class Numberseries1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int num=3;
        int count=1;
        while(count&amp;lt;=10) {
            System.out.println(num);
            num=num+1;
            System.out.println(num);
            num=num+3;
            count=count+2;

        }

    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3
4
7
8
11
12
15
16
19
20

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Look at this series: 1.5, 2.3, 3.1, 3.9, 4.7, 5.5, 6.3,... What number should come next?&lt;/p&gt;

&lt;p&gt;4.2&lt;/p&gt;

&lt;p&gt;4.4&lt;/p&gt;

&lt;p&gt;4.7&lt;/p&gt;

&lt;p&gt;5.1&lt;/p&gt;

&lt;p&gt;Ans:&lt;br&gt;
Let’s examine the differences between the numbers in the series:&lt;/p&gt;

&lt;p&gt;1.5 + 0.8 = 2.3 &lt;br&gt;
2.3 + 0.8 = 3.1 &lt;br&gt;
3.1 + 0.8 = 3.9 &lt;br&gt;
3.9 + 0.8 = 4.7 &lt;br&gt;
4.7 + 0.8 = 5.5&lt;br&gt;
5.5 + 0.8 = 6.3&lt;/p&gt;

&lt;p&gt;It looks like the series increases by 0.8 each time. So, to find the next number:&lt;br&gt;
6.3 + 0.8 = 7.1&lt;br&gt;
The next number in the series is 7.1. &lt;/p&gt;

&lt;h2&gt;
  
  
  Program:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class floattask {

public static void main(String[] args) {
// TODO Auto-generated method stub
float no=1.5f;
int count=1;
while(count&amp;lt;=8) {
System.out.println(no);
no=no+0.8f;
count=count+1;
}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1.5
2.3
3.1
3.8999999
4.7
5.5
6.3
7.1000004
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Day18; Control flow statement</title>
      <dc:creator>AmalaReegan</dc:creator>
      <pubDate>Fri, 07 Feb 2025 04:27:36 +0000</pubDate>
      <link>https://dev.to/reegan/day18-control-flow-statement-7aa</link>
      <guid>https://dev.to/reegan/day18-control-flow-statement-7aa</guid>
      <description>&lt;h2&gt;
  
  
  Control flow statement:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Control flow statements are fundamental components of programming languages that allow developers to control the order in which instructions are executed in a program.&lt;/p&gt;

&lt;p&gt;==&amp;gt; They enable execution of a block of code multiple times, execute a block of code based on conditions, terminate or skip the execution of certain lines of code, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Control Flow statements:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnriq9x2cmsx5u64cew3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnriq9x2cmsx5u64cew3.png" alt="Image description" width="800" height="498"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsri44dv22vbs0rw5j28k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsri44dv22vbs0rw5j28k.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Looping Statements:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Looping statements, also known as iteration or repetition statements, are used in programming to repeatedly execute a block of code.&lt;/p&gt;

&lt;p&gt;==&amp;gt; They are essential for performing tasks such as iterating over elements in a list, reading data from a file, or executing a set of instructions a specific number of times. Here are some common types of looping statements:&lt;/p&gt;

&lt;p&gt;1.For loop&lt;br&gt;
2.While loop&lt;br&gt;
3.Do while loop&lt;/p&gt;

&lt;h2&gt;
  
  
  While loop:
&lt;/h2&gt;

&lt;p&gt;==&amp;gt; Java while loop is a control flow statement used to execute the block of statements repeatedly until the given condition evaluates to false.&lt;/p&gt;

&lt;p&gt;==&amp;gt; Once the condition becomes false, the line immediately after the loop in the program is executed. &lt;/p&gt;

&lt;h2&gt;
  
  
  Syntax:
&lt;/h2&gt;

&lt;p&gt;while (condition) {&lt;br&gt;
    // Code to be executed&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0d3ady7rmmm26e77cc6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0d3ady7rmmm26e77cc6.png" alt="Image description" width="800" height="684"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;==&amp;gt; The condition is evaluated before each iteration.&lt;br&gt;
 ==&amp;gt; If the condition is true, the loop executes the block of &lt;br&gt;
     code.&lt;br&gt;
 ==&amp;gt; If the condition is false, the loop stops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example:Printing number from 1 to 10:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package javaprogram;

public class Whileloop {
    public static void main(String []args)
    {
    int num=1;
    while(num&amp;lt;10)
    {
    System.out.println(num);
    num=num+1;
    }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
4
5
6
7
8
9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Task1:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7vyp477ve29va3205om.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7vyp477ve29va3205om.png" alt="Image description" width="800" height="783"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Program:
&lt;/h2&gt;

&lt;p&gt;package javaprogram;&lt;/p&gt;

&lt;p&gt;public class task {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static void main(String[] args) {
    // TODO Auto-generated method stub
    int count=5;
    while(count&amp;lt;=20)
    {
        count=count+3;
        System.out.println(" count:"+count);
    }


}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;count:8&lt;br&gt;
 count:11&lt;br&gt;
 count:14&lt;br&gt;
 count:17&lt;br&gt;
 count:20&lt;br&gt;
 count:23&lt;/p&gt;

&lt;h2&gt;
  
  
  Task2:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faesyp1zhhws6tfux8amh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faesyp1zhhws6tfux8amh.png" alt="Image description" width="800" height="783"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Example program:
&lt;/h2&gt;

&lt;p&gt;package javaprogram;&lt;/p&gt;

&lt;p&gt;public class welcome {&lt;br&gt;
public static void main(String[] args) {&lt;br&gt;
    int count=1;&lt;br&gt;
    while(count&amp;lt;=10) {&lt;br&gt;
        System.out.println("welcome to java");&lt;br&gt;
        count=count+1;&lt;br&gt;
    }&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
}&lt;/p&gt;

&lt;h2&gt;
  
  
  Output:
&lt;/h2&gt;

&lt;p&gt;welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;br&gt;
welcome to java&lt;/p&gt;

&lt;p&gt;Refernce:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/java/java_while_loop.asp" rel="noopener noreferrer"&gt;https://www.w3schools.com/java/java_while_loop.asp&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.geeksforgeeks.org/java-while-loop-with-examples/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/java-while-loop-with-examples/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.geeksforgeeks.org/control-flow-statements-in-programming/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/control-flow-statements-in-programming/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.codingem.com/flowchart-loop/" rel="noopener noreferrer"&gt;https://www.codingem.com/flowchart-loop/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
