Print Sum of Series 1/1^2 + 1/2^2 + 1/3^2 …………1/n^2 in Java.
import java.util.Scanner; public class Series { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the no of terms...
Print Sum of series 1+ (1+2) + (1+2+3)……. (1+2+3+…….n) in Java
import java.util.Scanner; public class Series { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the no of...
Print sum of series 1/1^3 – 1/2^3 + 1/3^3…….1/n^3 in Java.
import java.util.Scanner; public class Series { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double sum = 0;...
Print Series 1, 11, 111, 1111……..n terms in Java.
import java.util.Scanner; public class Series { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Enter the number of terms:...
Print Series 1, 12, 123, 1234, …………n in Java.
import java.util.Scanner; public class Series { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Enter the number of terms:...
Print Series 1, -3, 5, -7, …………n terms in Java.
import java.util.Scanner;public class OddSeries { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Enter the number of terms: "); int n...
Print Series 2, -4, 6, -8,………n terms in Java
import java.util.Scanner;public class Series { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int c, i = 2, n; ...
Java program to print Tribonacci Series.
A tribonacci series is one in which the sum next term is the sum of previous three terms Example 0 1 2...
Java program to print fibonacci series.
A fibonacci series is one in which the next term is the sum of previous two terms Example. 0 1 1 2 3...
Java program to find the frequency of one string in another string.
import java.util.Scanner; public class WordFrequencyCounter { public static void main(String args[]) { Scanner scan = new Scanner(System.in);...
Java program to remove vowels from a string.
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader; public class RemoveVowels{ public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str1,...
Java program to remove common characters from two strings.
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class RemoveCommonDuplicateChar { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s1, s2,...
Java program to reverse a String without using direct method.
import java.io.BufferedReader; public class ReverseOfString { public static String reverseString(String s) { int l = s.length(); String backward = ""; ...
Java program to finding Shortest and Longest Words in a String.
import java.io.BufferedReader;class FindMinMaxString { public static void main(String args[]) { findMethod("My name is Umesh Kushwaha"); } static public void findMethod(String s) { String str =...
Java program to input name, middle name and surname of a person and print only the initials.
Example.Enter your nameUmesh Kumar KushwahaInitials are U.K.K.import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;class InitialName { public static void main(String args[]) throws IOException { BufferedReader br...
Java program to accept a string and print each character of the string along with its ASCII code.
class CalculateAscii { public static void main(String args[]) { word("Umesh Kushwaha"); } static void word(String s) { int len = s.length(); int a; char a1; ...
Java program to count the occurrence of any character in given String.
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.logging.Level;import java.util.logging.Logger;class CountFrequencyOfWord { public static void main(String args[]) { try { input(); } catch (IOException ex) { Logger.getLogger(CountFrequencyOfWord .class.getName()).log(Level.SEVERE,...
Java program to remove duplicates characters from given String.
class RemoveDuplicate { public static void main(String args[]) { remove("123aa bbbcc c2589 99oppq rtyyy"); } static void remove(String s) { int l = s.length(); int...
Java program to check Palindrome Number.
/*This program shows how to check for in the given list of numberswhether each number is palindrome or not*/public class JavaPalindromeNumberExample { public...
Java program to calculate the Simple Interest and Input by the user.
import java.util.*; class SimpleInterest { int p, t; float si, r; public si() { r = 0; p = 0; } public...