#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[20],str2[20],str3[6]={'F','L','A','M','E','S'},temp[1];
int space=0,x=0,k,count1,count2,i,j,shift;
clrscr();
printf("Enter the 1st Name:\n");
gets(str1);
printf("Enter the 2nd Name:\n");
gets(str2);
count1=strlen(str1);
count2=strlen(str2);
for(i=0;i<count1;i++)
{
if(str1[i]==' ')
{space--;
}
}
for(j=0;j<count2;j++)
{
if(str2[j]==' ' && space==0)
{space--;}
else if(str2[j]==' ')
{space++;}
else;
}
start:
for(i=0;i<count1;i++)
{
for(j=0;j<count2;j++)
{
if(str1[i]==str2[j])
{
for(k=i;k<count1;k++)
{
str1[k]=str1[k+1];
}
for(k=j;k<count2;k++)
{
str2[k]=str2[k+1];
}
count1--;
count2--;
goto start;
}}}
x=count1+count2+space;
printf("Distinct Characters:%d\n",x);
for(i=6;i>1;i--)
{
shift=x%i;
for(k=shift;k>=1;k--)
{
temp[0]=str3[0];
for(j=1;j<=i-1;j++)
{
str3[j-1]=str3[j];
}
str3[i-1]=temp[0];
}
}
switch(str3[0])
{
case 'F':printf("\nFriend");break;
case 'L':printf("\nLove");break;
case 'A':printf("\nAffection");break;
case 'M':printf("\nMarriage");break;
case 'E':printf("\nEnemy");break;
case 'S':printf("\nSister");break;
}
getch();
}
OUTPUT:-
IF U HAVE DOUBT IN THIS:-
Mail Me: manikandang29892@gmail.com
#include<conio.h>
#include<string.h>
void main()
{
char str1[20],str2[20],str3[6]={'F','L','A','M','E','S'},temp[1];
int space=0,x=0,k,count1,count2,i,j,shift;
clrscr();
printf("Enter the 1st Name:\n");
gets(str1);
printf("Enter the 2nd Name:\n");
gets(str2);
count1=strlen(str1);
count2=strlen(str2);
for(i=0;i<count1;i++)
{
if(str1[i]==' ')
{space--;
}
}
for(j=0;j<count2;j++)
{
if(str2[j]==' ' && space==0)
{space--;}
else if(str2[j]==' ')
{space++;}
else;
}
start:
for(i=0;i<count1;i++)
{
for(j=0;j<count2;j++)
{
if(str1[i]==str2[j])
{
for(k=i;k<count1;k++)
{
str1[k]=str1[k+1];
}
for(k=j;k<count2;k++)
{
str2[k]=str2[k+1];
}
count1--;
count2--;
goto start;
}}}
x=count1+count2+space;
printf("Distinct Characters:%d\n",x);
for(i=6;i>1;i--)
{
shift=x%i;
for(k=shift;k>=1;k--)
{
temp[0]=str3[0];
for(j=1;j<=i-1;j++)
{
str3[j-1]=str3[j];
}
str3[i-1]=temp[0];
}
}
switch(str3[0])
{
case 'F':printf("\nFriend");break;
case 'L':printf("\nLove");break;
case 'A':printf("\nAffection");break;
case 'M':printf("\nMarriage");break;
case 'E':printf("\nEnemy");break;
case 'S':printf("\nSister");break;
}
getch();
}
OUTPUT:-
IF U HAVE DOUBT IN THIS:-
Mail Me: manikandang29892@gmail.com

No comments:
Post a Comment