Skip to main content

Posts

Featured

Simple Java Programs You Should Know

Simple Java Programs You Should Know Hi friends, today I'm going to provide you some of the  simple java programs  that you may learn to write, which may help to improve your coding skills if you are a beginner. So here I am going to show you 5 java programs, you may also write it if you want. 1) Write a program to the square root of the number to be entered by the user. import java.util.*; class SquareRoot {     void Sqroot(double a)     {         System.out.println("The Square Root of the number "+ Math.sqrt(a));              }     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         SquareRoot ob= new SquareRoot();         double a;         System.out.println("Enter a number");         a=in.nextDouble();         ob.Sqroot(a);     } } Output: 2) Write a program to print a random number between 0 to 9. class Random {     public static void main(String args[])     {         double a;         a=Math.random()*10;      

Latest posts

Some Programs Using Math function in Java

Java program to find the square root of a number

Java program to find sum of two numbers

Java Program to Find Greatest Number using Math class

Java program to find sum of natural numbers

CFOP Method - Ways To Learn CFOP Method Easily