Friday, 24 April 2020

Java Program (Basic 2)


   

                                          Program - 4
class  Arithmetic
{
    public static void main(String args[])
    {
        int a=18 , b=6 ;
        int x , y , z , e;       
        x = a+b ;        y = a-b ;        z = a*b ;        e = a/b ;
        System.out.println(" The sum is = " +x );
        System.out.println(" The difference is = " +y );
        System.out.println(" The product is = " +z );
        System.out.println(" The Div is = " +e );
    }
}


                                           Program - 5 
class  TotAvg
{
    public static void main(String args[])
    {
        int P , C , M ;
        P=60 ; C=55 ; M=95 ;       
        int Total ;
        float Average ;       
        Total = P+C+M ;
        Average = Total/3 ;       
        System.out.println("Total Marks = " +Total);
        System.out.println("Average  = " +Average);
    }
}


                                           Program - 6 
class  Details
{
    public static void main(String args[])
    {
        int RollNo = 5 ;
        String Name = "SANJEET" ;
        char clss = 'X' ;
        String Address = "DHANBAD , JHARKHAND" ;      
        System.out.println("Roll Number is  " +RollNo);
        System.out.println("Name  = " +Name);
        System.out.println("CLASS  = " +clss);
        System.out.println("Address is " +Address);
    }
}



No comments:

Post a Comment