Write a program in Java to assign an integer with a value 33 and a fractional value 12.5.Print the cube of integer and square of fractional value
Answers
Answered by
7
Answer:
class Assign{
public static void main (String ar[]){
int a=33;
double b=12.5;
System.out.println("Cube of "+a+" is "+(a*a*a);
System.out.println("Square of "+b+" is "+(b*b));
}
}
Logic:-
- Assign both the numbers to variables a,b.(say, a stores integer and b stores fractional value)
- print the cube of a
- print the Square of b
Similar questions