Showing posts with label Math function max(). Show all posts
Showing posts with label Math function max(). 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 smallest of two value using Math Function min()

Program :

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

n1 = 3 ;
n2 = 4 ;

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

    }
}

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 = ...