Sunday, December 9, 2012

WAP to compare two Strings 43


#include<stdio.h>
#include<conio.h>
void main()
{

 int str1[100],str2[100],n1,n2;
 clrscr();
 printf("\nenter string 1:");
 gets(str1);
 printf("\nenter string 2:");
 gets(str2);
 n1=strlen(str1);
 n2=strlen(str2);
 printf("\n%d",n1);
 printf("\n%d",n2);
 if(n1==n2)
 {
printf("two string is ezual:");
 }
 else if(n1<n2)
 {
printf("\n str1 is less from str2:");
 }
 else
 {
printf("\n str1 is greeter from str2");
 }
 getch();
}

No comments:

Post a Comment