+ 7
Can u please tell me... What's wrong with this program..
import java.util.*; class temp{ public static void main(String args[]) {int T; Scanner in= new Scanner(System.in); System.out.println("enter the temperature"); T=in.nextInt(); if(T>=20) { System.out.println("day is cold"); } else if(T>20 && T<=40) { System.out.println("day is normal"); } else(T>40) { System.out.println("day is hot"); } } }
11 ответов
+ 7
You can't do else(condition).
you can not test condition with else.
Use else if(condition)
mistake ---> else(T>40)
should be ---> else if(T>40)
+ 6
I know 😂 nice to play with you 🙏😍
+ 5
ya OK
+ 3
import java.util.*;
class temp {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the temperature");
int T;
T = in.nextInt();
if(T<=20){
// pay attention to logic errors
System.out.println("day is cold");
} else if(T>20 && T<=40){
System.out.println("day is normal");
} else if (T>40){
System.out.println("day is hot");
}
}
}
+ 3
you cannot compare a condition within in else. use else if instead of else.
+ 2
don't use else after elseif statement it should be elseif again
+ 1
I think:
if(T<=20){
.....}
+ 1
challenge limited stop me at sololearn only with your
+ 1
tomorrow again play okkk
0
You can not assign a value to else, it doesnt exists else (condition)
- 3
Abe BC else if k bad else nai aata else if hi aata