Wednesday, 1 April 2015

Exercise-8 : Write a Java program to calculate the SUM and COUNT of Primes from a given range of numbers. Formatting required for the Input and Output statements. Use Method with Parameter and return value to the Main function.

package exx4;
class Bx{
int width,height;
int muti()
{   
return width*height;
}

void getvalue( int w, int h)
{
width = w;
height =h;   
}
}
public class Exx4 {
    public static void main(String[] args) {
         Bx ob1 = new Bx();
         Bx ob2 = new Bx();
         double value;
         ob1.getvalue(10,5);
         ob2.getvalue(20,4);
         value =ob1.muti();
         System.out.println("Result is secound " +value);
        
         value =ob2.muti();
         System.out.println("Result is secound " +value);
    }
   
}

No comments:

Post a Comment