This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| class Swapping{ | |
| public static void main(String[] args){ | |
| Scanner input = new Scanner(System.in); | |
| int x, y; | |
| System.out.print("Enter 1st number : "); | |
| x = input.nextInt(); | |
| System.out.print("Enter 2nd number : "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class Swapping { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.println("Input first number: "); | |
| int num1 = input.nextInt(); | |
| System.out.println("Input second number: "); | |
| int num2 = input.nextInt(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import net.lingala.zip4j.ZipFile; | |
| import net.lingala.zip4j.exception.ZipException; | |
| public class Zip { | |
| public static void main(String[] args) { | |
| try { | |
| new ZipFile("zip1.zip").addFile("Path of the file that you want to create as a Zip"); | |
| System.out.println("Zip Created Successfully...!"); | |
| } catch (ZipException e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class AddNumbers { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| int total = 0; | |
| int num; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class Count { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.print("Enter number: "); | |
| int num = input.nextInt(); | |
| int count = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class ReversedWhileLoop { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| System.out.print("Enter num: "); | |
| int num = input.nextInt(); | |
| while (num != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DisplayOdd { | |
| public static void main(String[] args) { | |
| System.out.print("["); | |
| for (int i = 0; i < 10; i++) { | |
| if (i % 2 == 0) { | |
| continue; | |
| } | |
| System.out.print(i + " , "); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NestedForLoop { | |
| public static void main(String[] args) { | |
| System.out.println("Start"); | |
| for (int i = 0; i < 10; i++) { | |
| for (int j = 0; j < 10; j++) { | |
| System.out.println(i + " : " + j); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Random; | |
| public class FindCount { | |
| public static void main(String[] args) { | |
| Random input = new Random(); | |
| for (int i = 0; i < 10; i++) { | |
| int rand = input.nextInt(); | |
| int count = findDigitsCount(rand); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class ClassMark { | |
| public static void main(String[] args) { | |
| Scanner input = new Scanner(System.in); | |
| // Create an array | |
| System.out.println("Enter num of sub: "); | |
| final int N = input.nextInt(); | |
| int[] x = new int[N]; |
OlderNewer