Deleted AccountPlz someone help
Bro simple just take a loop and which is not divisible by any number print it.
Deleted AccountPhoto from Ramdev Kalantri
var Input=15;var c=[];var log=1;while (c.length !== Input) {let sum=log%2;if (!sum == 0){c.push(log)};log+=1};console.log(c)
K import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Scanner; public class Main { private static boolean isPrime(int n) { if (n <= 1) { return false; } double sqrt = Math.sqrt(n); for (int i = 2; i <= sqrt; i++) { if (n % i == 0) { return false; } } return true; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); LocalDate start = LocalDate.parse(sc.next(), DateTimeFormatter.ofPattern("yyyyMMdd")); String day = sc.next(); int n = sc.nextInt(); sc.close(); int previousPrimeDuration = 0; for (int i = 2; ; i++) { if (isPrime(i)) { start = start.plusDays(i - previousPrimeDuration); if (isPrime(start.getMonth().ordinal() + 1) && start.getDayOfWeek().name().substring(0, 3).equals(day.toUpperCase())) { System.out.println((i <= n? "Yes ": "No ") + i); return; } previousPrimeDuration = i; } } } }
Ankit96Photo
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
int n = sc.nextInt(), m = sc.nextInt();
List<Set<Integer>> list = new ArrayList<>(n);
loop: for (int j = 0; j < m; j++) {
int a = sc.nextInt(), b = sc.nextInt();
for (Set<Integer> set: list) {
if (set.contains(a)) {
set.add(b);
continue loop;
} else if (set.contains(b)) {
set.add(a);
continue loop;
}
}
Set<Integer> set = new HashSet<>();
set.add(a);
set.add(b);
list.add(set);
}
int count = 0;
for (Set<Integer> set: list) {
count += set.size();
}
System.out.println(list.size() + n - count);
}
}
}
Deleted AccountPhoto from Ramdev Kalantri
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.close();
loop: for (int i = 2, c = 0; c < n; i++) {
double sqrt = Math.sqrt(i);
for (int j = 2; j <= sqrt; j++) {
if (i % j == 0) {
continue loop;
}
}
System.out.print(i + " ");
c++;
}
}
}
Padmasri ReddyPhoto
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
sc.close();
int litres = 0;
for (int i = 1; i < n-1; i++) {
int leftMax = Arrays.stream(arr, 0, i).max().getAsInt();
int rightMax = Arrays.stream(arr, i+1, n).max().getAsInt();
int waterHeight = Math.min(leftMax, rightMax) - arr[i];
if (waterHeight > 0) {
litres += waterHeight;
}
}
System.out.println(litres);
}
}
Padmasri ReddyPhoto
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
sc.close();
System.out.println(Math.round(Arrays.stream(arr).average().getAsDouble()));
}
}
LTI is hiring for below multiple cloud job profiles.
if any interested, please share your details to [email protected]
in below format, Also please mention your profile in the mail subject
First Name:
Last Name:
Mail ID:
JR Code:
Need immediate joiners preferred within 0-30 days...!!
Grab this opportunity...!!!
Java Fullstack - 577007 - 3-15 Yrs
C++ - 540469 - 3-10 Yrs
Devops, Azure Devops, Devops Architect - 671327 - 3-9 Yrs
AWS & Azure Architect (Migration and Automation) - 837287 - 9-14 Yrs
Azure, .Net, Angular, Python, React JS, Java - 576929 - 3-10 Yrs
AWS & Java8 Springboot / Node JS / Python / .Net Core - 887534 - 3-10 Yrs
#Connections please do hit the like button,👍 comment, ✍️and share the post with your connections.📲.