wap to calculate square and cube of number without using any extra variable (only 1 variable) in java
Answers
Answered by
1
Answer:
import java.io.*;
class GFG
{
public static void main(String[] args)
{
int n=5;
n=n*n;
System.out.println(" n^2 = " +n);
n=n*5;
System.out.println(" n^3 = " +n);
}
}
Similar questions
Math,
7 months ago
English,
7 months ago
Math,
1 year ago
Biology,
1 year ago
Social Sciences,
1 year ago