What mistake is there please anyone tell ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What mistake is there please anyone tell ?

import java.util.*; public class Program { public static void main(String[] args){ Scanner sc=new Scanner (System.in); int a=sc.next(); if (a<5){ System.out.println("No.is less than Five"); }else{ System.out.println("No.is greater than Five"); } } }

7th Jan 2023, 1:39 PM
Suraj
Suraj - avatar
1 Answer
+ 3
sc.next() reads a word of string. Instead use int a = sc.nextInt();
7th Jan 2023, 1:44 PM
Jayakrishna 🇮🇳