Write a program to create a class Formula and initialize integers a, b, c with values 5, 7, 9. Perform the following operations and print the results of the operations. s = (a + b + c) / 2.0 and v = (a2 + b2 ) / c2
Answers
Answered by
1
Answer:
class Formula
{
public static void main(String[] args)
{
//Declaration
int a, b, c;
double s, v;
//Initialization
a = 5;
b = 7;
c = 9;
//Calculate the values of s and v
s = (double)(a + b + c)/2.0;
v = (Math .pow(a, 2) + Math.pow(b, 2))/)Math.pow(c, 2));
//Print the results
System.out.println("The value of s is = " + s);
System.out.println("The value of v is = " + v);
}
}
Similar questions