+ 1
how to code this using the ?: operation. Output is in brackets
Enter amount: (100000) Enter the term in years: (1) Rate = 2.5 Interest in year 1 $2500.0
1 Réponse
+ 7
? : is a ternary operator. Same like if-else statements.
int i=3;
if (i>2){
System.out.print("hi");
}
else{
System.out.print("no");
}
shorthand.
System.out.print( i>2? "hi": "no");