Skip to main content

Posts

Showing posts from July, 2020

Java program to find the prime number.

                            Let us see the java program to find the prime number. so first we should know about prime number. and logic to write a program, get to know about them below. Content. What is prime number. Logic for program. Program. Explanation. Output. What is prime number?                    Prime number is the number which can divide by 1 and itself only. Example:                    2,3,5,7,11... Logic for the Program. We need to give limits to start and end the prime number. Then make the number between the limits divide each other, if the reminder is a zero then it is prime number. if we get any number other then zero it is not a prime number it does of come in sequence. we use for loop and if statement. Program import java.io.*; class prime {   public static void main(String ar...

Java program to check to weather the program palindrome or not.

                Let us see the java program to check the string is palindrome or not. so first we should know about palindrome. and logic to write a program, get to know about them below. Content. What is palindrome the string. Logic for program. Program. Explanation. Output. What is palindrome the string?              Palindrome string means if we give a number like 858, when the number is palindrome we should get same number, 858. Example:                      our Input:  malayalam                         Output:  malayalam Logic for the Program. We need to display the last string first. So, when we use that in a loop, to get the Reversed string. And check whether the reversed string is equal to the given string, if it is equal, then string is palindrome...

Java program to reverse the string.

                Let us see the java program to reverse the string.  Content. What is Reverse the String. Logic for program. Program. Explanation. Output. What is Reverse the string?              Revering string means the order of the string changes, it displays the string from backward. Example:                      our Input: name                         Output:  eman Logic for the Program. We need to display the last string first. So, when we use that in a loop, to get the Reversed string. Program import java.io.*; class exrev {   public static void main(String args[]) throws IOException    {      String A, B="";      int x,y;      char c;      InputStreamReader rea...

Java program to check the number is palindrome or not.

                Let us see the java program to check the number is palindrome or not. so first we should know about palindrome. and logic to write a program, get to know about them below. Content. What is palindrome the number. Logic for program. Program. Explanation. Output. What is palindrome the number?              Palindrome number means if we give a number like 858, when the number is reversed we should get same number, 858. Example:                      our Input:  2002                         Output:  2002 Logic for the Program. We need to display the last number first so, we divide(%) the number by 10 and take the reminder as answer. So, when we use that in a loop we get the Reversed number. And check whether the reversed ...

Java program to find the reverse the number.

                   Let us see the java program to reverse the number.  Content. What is Reverse the number. Logic for program. Program. Explanation. Output. What is Reverse the number?                 Revering number means the order of the number changer, it displays the number from backward. Example:                          our Input: 9874                         Output: 4789 Logic for the Program. We need to display the last number first so, we divide(%) the number by 10 and take the reminder as answer. So, when we use that in a loop we get the Reversed number. Program import java.io.*; class reve {  public static void main(String arg[]) throws IOException   {     int n,r,s=0;     InputStreamReader read = new In...

Java program to check whether year is leap year or not.

                                  We are gonna check weather the given year is leap year or not. So first, what is leap year. How to write a program. CONTENT. What is leap year? Logic for the program. Program. Explanation. Output. What is leap year?           Usually, we have 365 days per year but, t he leap year is the year which has 366 days per year.           It is said that leap is repeated every four year.                     formula:    year%4=0 Logic for the program. As we know leap year is repeated for every four year we need to divide the year we select by 4. If the answer is 0, the year is leap year, if not it is not leap year. Program. import java.io.*; class leap {  public static void main(String args[]) throws IOException  {   int y; ...

Java program to check the number is odd and even.

              Lets us write a p rogram to check the number is odd and even  using java program. so first, what are odd numbers? and what are even numbers? How to write the program. CONTENT What are odd and even numbers? logic for the program. Program. Explanation. Output. Task. What are odd numbers?          The numbers which are not divided by 2 or the numbers which has reminder 1, when it is divided by 2 are known as odd numbers Example:                 1,3,5,7,9... What are even numbers?         The numbers which are divided by 2 or the numbers which has reminder 0, when it is divided by 2 are known as even numbers Example:                    2,4,6,8,10... Logic for the program. We have to ways to create program. 01. we are declaring a variable, that variable sound be divided (%) by 2 and that sho...

Find factorial using java program.

              let us find the factorial of the number using java program. For that, we should learn what is factorial of a number and what is the logic we should put in the program. Content. What is factorial of a number? Logic for the program. Program. Explanation of program. Output Task. What is factorial of a number?               Let us have a number n, the product of all the positive numbers until the number is known as factorial of the number.     formula:                    n!=n*(n-1)*(n-2)*......*1.     example:                    5! = 5*(5-1)*(5-2)*(5-3)*(5-4).                       5! = 5*4*3*2*1.                           ...

Short note on Bitwise operator in java.

            Operators are symbol that tells the computer to perform certain mathematical or logical function. We have 8 types of operator, bitwise is on of them. and also very important topic. know more about operator . --------------------------------------------------------------------------------------------- CONTENT. What is bitwise operator? Types of bitwise operator. Explanation of the types. --------------------------------------------------------------------------------------------- What is bitwise operator?         Java support  a powerful set of operator known as bitwise operator.         The bitwise operator is used for controlling and interacting with hardware and also for manipulating data at the bit level. Types of bitwise operator.     There are six types of bitwise operator. Bitwise AND ( & ) Bi...