Showing posts with label math function expo(). Show all posts
Showing posts with label math function expo(). Show all posts

Friday, 13 December 2019

write a java program to demonstrate used of Math Function round()

 Program :

import java.lang.Math ;
public class RoundFun
{
    public static void main(String[] args) {
       
        double d1 = 201.653 ;
        System.out.println("Round value of d1 : " +Math.round(d1)) ;   
    }
}

Output :


write a java program to demonstrate used of Math Function pow()

Program :

import java.lang.Math ;
public class Power
{
    public static void main(String[] args) {
        double n1 = 2 , n2 = 3;

        System.out.println(+n1 + " ^ " + n2 + " = " +Math.pow(n1 , n2 ));
    }
}

Output :


write a java program to find the largest of two value using Math Function max()

Program :

import java.lang.Math ;
public class Maximum
{
    public static void main(String[] args) {  
 
        int n1 , n2 ;

        n1 = 3 ;
        n2 = 4 ;

        System.out.println("Maximum of " + n1 +" and " + n2 + " is " + Math.max(n1 , n2)) ;

    }
}

Output :


write a java program to demonstrate increment and decrement Operator

 Program :

class IncDec
{
    public static void main(String[] args) {

        int a , b ;

        a = 2 ;
        b = 3 ;

        a++ ;
        ++a ;
        System.out.println("Value of after increment " +a) ;

        --b ;
        b-- ;
        System.out.println("Value of after decrement " +b) ;
    }
}


Output :


Write a java program to find the greatest among Three Number

 Program :

class GreatestThree
{
    public static void main(String[] args) {
        int x = 5 , y = 7 , z = 9 ;

if(x > y && x > z)
System.out.println("x is Greatest");

else
            if(y > x && y > z)
System.out.println("Y is Greatest");

else
System.out.println("Z is Greatest");   
        }
    }

Output :


Write a java program to input marks of 5 student if 5 subject out of 100 marks each , output sum and percentage of marks and appropriate division i.e distigusion first class upto fail

Programe : import java.util.*; class Student { public static void main(String args[])     {     Scanner s = ...