Problem:
To find the length of the given string without using any strlen function
Solution:
#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],i,j;
clrscr();
printf("\nenter the string without space");
scanf("%s",a);
for(i=0;a[i]!='\0';i++);
printf("the length of the string is %d",i);
getch();
}
Output:
To find the length of the given string without using any strlen function
Solution:
#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],i,j;
clrscr();
printf("\nenter the string without space");
scanf("%s",a);
for(i=0;a[i]!='\0';i++);
printf("the length of the string is %d",i);
getch();
}
Output:
No comments:
Post a Comment