Computer Science, asked by bazigarooo, 6 months ago

How many error(s) the following code has –.
class Q5 { public static void main(String args[ ] )
{ if(n>120) { int m = Math.pow(n,2) System.out.println(“Square=”+n);
else int m = Math.pow(3,n); System.out.println(“Cube=”+ m ); } } }​

Answers

Answered by mak94
0

Answer:

isme following codes kaha likha rahe he or ache se likhiye question

Answered by Anonymous
0

class Q5

{

public static void main(String args[ ] )

{

if(n>120)

{

int m = Math.pow(n,2)

System.out.println(“Square=”+n);

}

else

{

int m = Math.pow(3,n);

System.out.println(“Cube=”+m);

}

}

}

Error 1: Syntax error in line [int m = Math.pow(n,2)]

there must be a semi-colon at last.

Error 2: Logical error in line [System.out.println(“Square=”+n);]

The variable should be m not n because this value will be stored by variable m and n is for running the if else...

Similar questions