0
code is for loan calculator question in java , everything seems perfect, no compile errors, but this app isn't saying so,help
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); //your code goes here int i = 1; int j = 0; System.out.println(); while( i != 7){ j = a/10; if(a%10 >= 5){j = j + 1;} a = a - j; i++; } System.out.println( a); }}
10 Réponses
+ 1
In the short form case it happening automatic type casting but later need manual type cast because destination is of int type and resulted value is double value.. I came to know, its short form advantage..
Do like this : a=(int)(a*0.9);
+ 3
After seeing the description, you need to round up the value of j.
So Shubham Bawner use
if(a%10>0) j =j+1 ;
+ 2
Can you add problem description or link..?
BTW, is there asked to put a new line? If not remove, System.out.println(); and try.
+ 1
I think that's the task: https://www.sololearn.com/coach/949?ref=app. But I cannot understand the idea behind your code Shubham Bawner.
+ 1
Thanks lot all
I got the solution but other problem arises as I did
What is difference in a *= b& a=a*b
+ 1
Is it related to this question..?
BTW no difference.
a = a*b ; it's short form is a *= b;
0
That's what I say
But former works n later dosnt
0
Have a look in this code
0
Thanks Jayakrishna🇮🇳