Computer Science, asked by cakash6538, 11 months ago

Write a program to accept a three letter word as an input from the user and display the message

Answers

Answered by parthomsarwade
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