WAP ACCEPT A String and count char with using method?
int count=0;
Scanner obj = new Scanner(System.in);
String s1=obj.nextLine();
for(char c:s1)
{
count++;
}
System.out.print(count);
int count=0;
Scanner obj = new Scanner(System.in);
String s1=obj.nextLine();
for(char c:s1)
{
count++;
}
System.out.print(count);
No comments:
Post a Comment