Computer Science, asked by rashmimittal73, 2 months ago


Q6. WAP to accept a string from the user and display the number of characters in it.​

Answers

Answered by teju8910
2

Explanation:

JAVA

public class CountCharacter.

{

public static void main(String[] args) {

String string = "The best of both worlds";

int count = 0;

//Counts each character except space.

for(int i = 0; i < string.length(); i++) {

if(string.charAt(i) != ' ')

Similar questions