Write a program to accept a three letter word as an input from the user and display the message
Answers
Answered by
1
Answer:
import java.util.*;
class p1
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a letter word");
String s=sc.nextLine();
String d
int c=0;
while (s>0)
{
d=s%10;
c++;
s=s/10;
}
if(c==3)
System.out.println("3 letter word");
else
System.out.println("not 3 letter word");
}
}
Similar questions
Hindi,
6 months ago
India Languages,
6 months ago
Business Studies,
1 year ago
Computer Science,
1 year ago