Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions assignments/Solutions/01 solutions/LeapYear.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//1. Input a year and find whether it is a leap year or not.

import java.util.Scanner;

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

System.out.print("Enter a year: ");
int year = sc.nextInt();

if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
System.out.println(year + " is a Leap Year");
} else {
System.out.println(year + " is not a Leap Year");
}

sc.close();
}
}
15 changes: 15 additions & 0 deletions assignments/Solutions/01 solutions/Multiplication_table.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//3. Take a number as input and print the multiplication table for it.
import java.util.Scanner;

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

System.out.print("Enter a number: ");
int n = sc.nextInt();

for (int i = 1; i <= 10; i++) {
System.out.println(n + " x " + i + " = " + (n * i));
}
}
}
18 changes: 18 additions & 0 deletions assignments/Solutions/01 solutions/Sum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//2. Take two numbers and print the sum of both.

import java.util.Scanner;

public class Sum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter first number : ");
int a = sc.nextInt();

System.out.println("Enter second number : ");
int b = sc.nextInt();

int sum = a + b;
System.out.println("Sum = "+ sum);
sc.close();
}
}
4 changes: 2 additions & 2 deletions lectures/20-trees/code/AVL/.project
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
</natures>
<filteredResources>
<filter>
<id>1679078569810</id>
<id>1787461381643</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
Expand Down
4 changes: 2 additions & 2 deletions lectures/20-trees/code/Questions/.project
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
</natures>
<filteredResources>
<filter>
<id>1679078569810</id>
<id>1787461381639</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
Expand Down