SOURCE CODE:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int c,flag=0,i;
char a[25],b[25];
clrscr();
printf("Enter first string\n");
gets(a);
printf("Enter second string\n");
gets(b);
// c=strcmp(a,b);
while(a[i]!='\0'&&b[i]!='\0')
{
if(a[i]==b[i])
{
i++;
flag=1;
}
else
{
printf("string are not same");
flag=0;
break;
}
}
if(flag==1)
{
print("string are same");
}
getch();
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int c,flag=0,i;
char a[25],b[25];
clrscr();
printf("Enter first string\n");
gets(a);
printf("Enter second string\n");
gets(b);
// c=strcmp(a,b);
while(a[i]!='\0'&&b[i]!='\0')
{
if(a[i]==b[i])
{
i++;
flag=1;
}
else
{
printf("string are not same");
flag=0;
break;
}
}
if(flag==1)
{
print("string are same");
}
getch();
}
No comments :
Post a Comment