0% found this document useful (0 votes)
25 views1 page

Paper

The code takes user input of a number n and finds the nth probable prime number by repeatedly applying the nextProbablePrime() method to BigInteger 1. It then prints the result. The code also takes a string as input, removes non-alphabetic characters, counts vowels and consonants separately, and prints the counts.

Uploaded by

Rabilli Ganesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Paper

The code takes user input of a number n and finds the nth probable prime number by repeatedly applying the nextProbablePrime() method to BigInteger 1. It then prints the result. The code also takes a string as input, removes non-alphabetic characters, counts vowels and consonants separately, and prints the counts.

Uploaded by

Rabilli Ganesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.math.

BigInteger;
public class MyClass {
public static void main(String...args) {
Scanner s = new Scanner(System.in);
BigInteger bi = new BigInteger("1");
int n = s.nextInt();
for(int i = 0;i < n;i++)
bi = bi.nextProbablePrime();
System.out.println(bi);
}
}
import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String alpha = s.replaceAll("[^a-zA-Z]", "");
String vo = alpha.replaceAll("[^aeiouAEIOU]", "");
int vowels = vo.length();
int consonents = alpha.length()-vowels;
System.out.println(vowels+"\n"+consonents);
}
}

You might also like