+ 3
I need help in average word length
Case 3 and case5 are fails.
11 Antworten
+ 4
You need at the begin of code:
import java.util.Scanner;
+ 2
Hello Aravind P CSE TCET
Can you please show us your code?
+ 2
hoping you forgot to add import statement.
There it asked to round up result so use Math.ceil(a) instead of rounding. And convert result back to int type as
edit: (int) Math.ceil(a)
+ 1
Add :
import java.util.Scanner
+ 1
Aravind P CSE TCET I also said cast to int result. (Not meant to change data type) did you cast back result to int?
System.out.println( (int) Math.ceil(a) );
Edit:
In your above code, you are taking k as double so if one of type is already double then all calculations are already upcasted automatically to double. 2 of your (double) of casting have no effect.
0
Average of word length is equal to float(len(word))
I don't know java but use the length method and after getting the size change Data type of it to float
0
Already I used import statement
0
But the 3rd and 5th case only failed
0
If using Math.ceil(a) for rounding,the all test cases are failed
0
And also changed datatype to int