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
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions src/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import java.util.Scanner;

/**
* Lab006 class for performing integer division checks.
*/
public class Lab006 {
private int n;
private int m;

/**
* Constructor for initializing n and m.
* @param n The first integer.
* @param m The second integer.
*/
public Lab006(int n, int m) {
this.n = n;
this.m = m;
}

/**
* Check if n is evenly divisible by m.
* @return True if n is evenly divisible by m, false otherwise.
*/
public boolean isDivisible() {
return n % m == 0;
}

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

System.out.print("Enter the first integer (n): ");
int n = scanner.nextInt();

System.out.print("Enter the second integer (m): ");
int m = scanner.nextInt();

Lab006 lab = new Lab006(n, m);
boolean result = lab.isDivisible();

System.out.println(n + " is evenly divisible by " + m + ": " + result);
}
}

48 changes: 48 additions & 0 deletions src/Lab006.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//Naqibullah Haiwadpal
//10/28/2023 n
//Naqibullah Haiwadpal
//10/28/2023

import java.util.Scanner;

/**
* Lab006 class for performing integer division checks.
*/
public class Lab006 {
private int n;
private int m;

/**
* Constructor for initializing n and m.
* @param n The first integer.
* @param m The second integer.
*/
public Lab006(int n, int m) {
this.n = n;
this.m = m;
}

/**
* Check if n is evenly divisible by m.
* @return True if n is evenly divisible by m, false otherwise.
*/
public boolean isDivisible() {
return n % m == 0;
}

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

System.out.print("Enter the first integer (n): ");
int n = scanner.nextInt();

System.out.print("Enter the second integer (m): ");
int m = scanner.nextInt();

Lab006 lab = new Lab006(n, m);
boolean result = lab.isDivisible();

System.out.println(n + " is evenly divisible by " + m + ": " + result);
}
}