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
Social Sciences,
6 months ago
Science,
6 months ago
Social Sciences,
6 months ago
Business Studies,
11 months ago
Computer Science,
11 months ago