first commit

This commit is contained in:
2021-04-14 16:00:09 +05:30
commit 430dfcee8b
16 changed files with 574 additions and 0 deletions

24
LargestNumber.java Normal file
View File

@@ -0,0 +1,24 @@
// Program to find out the largest number (Dynamic Method).
import java.util.Scanner;
public class LargestNumber {
public static void main(String[] args) {
int n, max;
Scanner s = new Scanner(System.in);
System.out.println("Enter the number of elements:");
n = s.nextInt();
int a[] = new int[n];
System.out.println("Enter the elements of the array:");
for (int i = 0; i < n; i++) {
a[i] = s.nextInt();
}
max = a[0];
for (int i = 0; i < n; i++) {
if (max < a[i]) {
max = a[i];
}
}
System.out.println("Maximum value in this is: " + max);
}
}