shushank Python s=input() l=list(s) c=0 i=0 l.append(” “) while l[i]!=’ ‘: c+=1 i+=1 print(c) Log in to Reply
anilreddy #include #include int main() { int i,count = 0; char s[6]; printf(“enter the string”); gets(s); for(i=0;s[i]!=’\0′;i++){ count = count+1; } printf(“%d”,count); } Log in to Reply
SWATI import java.util.*; public class Main { public static void main(String[] args) { char arr[]=args[0].toCharArray(); int i=0; for(char c:arr) { System.out.println(“Hello World “+arr[i]); i++; } System.out.println(“String length “+i); } } Log in to Reply
anusha anusha a=input(“Enter string:”) count=0 for i in a: count=count+1 print(count) Log in to Reply
Rishav Raj Singh #include int main() { char s[1000]; int i; printf(“Enter a string: “); scanf(“%s”, s); for(i = 0; s[i] != ‘\0’; ++i); printf(“Length of string: %d”, i); return 0; } Log in to Reply
Angel Ashu #include int main() { char s[1000]; int c = 0; printf(“Input a string\n”); gets(s); while (s[c] != ‘\0’) c++; printf(“Length of the string: %d\n”, c); return 0; } Log in to Reply
Python
s=input()
l=list(s)
c=0
i=0
l.append(” “)
while l[i]!=’ ‘:
c+=1
i+=1
print(c)
#include
#include
int main()
{
int i,count = 0;
char s[6];
printf(“enter the string”);
gets(s);
for(i=0;s[i]!=’\0′;i++){
count = count+1;
}
printf(“%d”,count);
}
import java.util.*;
public class Main
{
public static void main(String[] args) {
char arr[]=args[0].toCharArray();
int i=0;
for(char c:arr)
{
System.out.println(“Hello World “+arr[i]);
i++;
}
System.out.println(“String length “+i);
}
}
a=input(“Enter string:”)
count=0
for i in a:
count=count+1
print(count)
string=input()
x=0
for i in string:
x=x+1
print(x)
a=input(“enter the string”)
cnt=0
for i in a:
cnt=cnt+1
print(cnt)
#include
int main()
{
char s[1000];
int i;
printf(“Enter a string: “);
scanf(“%s”, s);
for(i = 0; s[i] != ‘\0’; ++i);
printf(“Length of string: %d”, i);
return 0;
}
#include
int main()
{
char s[1000];
int c = 0;
printf(“Input a string\n”);
gets(s);
while (s[c] != ‘\0’)
c++;
printf(“Length of the string: %d\n”, c);
return 0;
}