Program to accept a string and find the length of the string - 100 Most Important C# Programs

100 Most Important C# Programs

59. Program to accept a string and find the length of the string

Code:

# include <stdio.h>

# include <conio.h>

main( )

{

char name[80];

int i;

clrscr( );

printf(“enter a string ;”);

for(i=0;i<80&&((name[i]=getchar( ))!

=’\n’);i++);

printf(“%d is the size of string”,i);

getch( );

}