Square of a number Level 1, Lesson 8
public class Solution {
public static void main(String[] args) {
//write your code here
int a = 5;
int result = sqr(5);
System.out.println (sqr(int a));
}
public static int sqr(int a) {
return a * a;
}
}
Help me to solve this
Archived
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Aswini
13 November 2018, 09:11
public class Solution {
public static void main(String[] args) {
//write your code here
System.out.println (sqr(5));
}
public static int sqr(int a) {
return a * a;
}
}
0
Khurram
12 November 2018, 05:57
when passing a value to the function sqr you only need to pass the variable name or a literal value like;
sqr(a)
sqr(5)
0
Aswini
13 November 2018, 09:12
thanks dear. anyhow i solved already.
public class Solution {
public static void main(String[] args) {
//write your code here
System.out.println (sqr(5));
}
public static int sqr(int a) {
return a * a;
}
}
0