-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d5689b
commit 4f519e3
Showing
8 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import java.util.*; | ||
|
||
public class CC_01 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
int n1 = sc.nextInt(); | ||
int n2 = sc.nextInt(); | ||
int sum = n1 + n2; | ||
int sub = n1 - n2; | ||
int mul = n1 * n2; | ||
int div = n1 / n2; | ||
int mod = n1 % n2; | ||
System.out.printf("Output: Sum: %d Sub: %d Mul: %d Div: %d Mod: %d", sum, sub, mul, div, mod); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import java.util.*; | ||
|
||
public class CC_02 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
int n = sc.nextInt(); | ||
if(n%2==0) { | ||
System.out.print("Output: "+ "Even"); | ||
} | ||
else { | ||
System.out.print("Output: "+ "Odd"); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import java.util.Scanner; | ||
|
||
public class CC_03 { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
float r = sc.nextFloat(); | ||
double area = 3.14*r*r; | ||
System.out.println("Output: "+ area); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import java.util.*; | ||
public class CC_04 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
int n1 = sc.nextInt(); | ||
int n2 = sc.nextInt(); | ||
int n3; | ||
n3 = n1; | ||
n1 = n2; | ||
n2 = n3; | ||
System.out.printf("Output: n1=%d n2=%d", n1, n2); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import java.util.Scanner; | ||
public class CC_05 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
int n1 = sc.nextInt(); | ||
int n2 = sc.nextInt(); | ||
if(n1>n2) { | ||
System.out.printf("Min=%d Max=%d", n2, n1); | ||
} | ||
else { | ||
System.out.printf("Min=%d Max=%d", n1, n2); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import java.util.Scanner; | ||
public class CC_06 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
int n1 = sc.nextInt(); | ||
int n2 = sc.nextInt(); | ||
int n3 = sc.nextInt(); | ||
int min = n1<n2 && n1<n3 ? n1 : n2<n1 && n2<n3 ? n2 : n3; | ||
int max = n1>n2 && n1>n3 ? n1 : n2>n1 && n2>n3 ? n2 : n3; | ||
System.out.printf("Min = %d Max = %d", min, max); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import java.util.Scanner; | ||
public class CC_07 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
System.out.print("Input: "); | ||
int n1 = sc.nextInt(); | ||
int n2 = sc.nextInt(); | ||
int n3 = sc.nextInt(); | ||
int second = n1>n2&&n1>n3?n2>n3?n2:n3 : n2>n1&&n2>n3?n1>n3?n1:n3 : n1>n2?n1:n2; | ||
System.out.print("Output: " + second); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import java.util.*; | ||
|
||
public class CC_08 { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int[] arr = {3,6,4,0,1,5,6}; | ||
System.out.print("Original Array: "); | ||
for(int i=0; i<arr.length; i++) { | ||
System.out.print(arr[i]+" "); | ||
} | ||
System.out.println(); | ||
int temp; | ||
for(int i=0; i<arr.length; i++) { | ||
for(int j=i+1; j<arr.length; j++) { | ||
if(arr[i]>arr[j]) { | ||
temp = arr[i]; | ||
arr[i] = arr[j]; | ||
arr[j] = temp; | ||
} | ||
} | ||
} | ||
System.out.println(); | ||
System.out.print("Sorted Array: "); | ||
for(int i=0; i<arr.length; i++) { | ||
System.out.print(arr[i]+" "); | ||
} | ||
} | ||
|
||
} |