Sunday 3 May 2015

LENGTH OF STRING

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int len;
char str[20],str2[20];
clrscr();
printf("\n enter a string");
gets(str);
printf("\n enter another string");
fflush(stdin);
gets(str2);
if(strcmp(str,str2)==0)
printf("\n  % & % both are equal",str,str2);
else if(strcmp(str,str2)<0)
printf("%s is smaller %s ",str,str2);
else if(strcmp(str,str2)>0)
printf("%s is greater than %s",str,str2);
getch();
}

No comments:

Post a Comment