+ 4
Using switch statement.
Need help on letter b and letter c? Im thinking about using switch case statement a. Proper Fraction – numerator is less than the denominator b. Improper Fraction – numerator is greater than the denominator, but the quotient is a real number (ex: 3.45) c. Whole Number – numerator is greater than the denominator, but the quotient has no decimal part
8 Antworten
+ 17
●please provide with code & give information about variable b & c.
● still by seeing previous comments, hopefully you have got to know that if else is better way to do it, here is rough code :
● if(num<den){
means proper fraction}
else{
if(num%den==0){
means whole number}
else{
means improper fraction}
}
+ 15
Switch case is used for one variable which may have different values.
The problem that you have mentioned involves evaluating calculation results on two variables, which should be coded with if else statements.
+ 8
The switch statement gives an alternative to a cascade of if-else constructs:
https://code.sololearn.com/ciAHNcOTEBAq/?ref=app
https://www.sololearn.com/learn/Java/2145/
+ 2
Thanks, guys for the help appreciate it. :)
0
Dd
0
Dd
0
Try to fix your code using if else statement.