Computer Science, asked by chukchukerail, 3 months ago

Write a program that accept a word and count the repetition of letter "E" in the supplied word

Answers

Answered by amansarrafas24payxgs
1

Answer:

import java.util.*;

class Word

{

public void main()

{

Scanner sc = new Scanner (System.in);

System.out.println("Enter a word: ");

String str = sc.next();

int len = str.length();

int count = 0;

for(int i = 0;i < len;i++)

{

char ch = str.charAt(i);

if(ch == 'E')

{

count++;

}

}

System.out.println("The word contain " + count + " times E repeated");

}

}

I hope you find it useful... If you have any query do comment, I will try to solve it...

Similar questions