Saturday, August 23, 2014

FLAMES PROGRAM IN C

Flames.....
Ppl check your relationship with others:

F-Friend
L-love
A-affection
M-marriage
E-enemy
S-Sister:-P


#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,d,j,l1,l2,c=0;
char name1[20],name2[20],name3[20]="FLAMES";
clrscr();
printf("\n\nenter the name:");
scanf("%s%s",name1,name2);
for(i=0;name1[i]!='\0';i++);
l1=i;
for(j=0;name2[j]!='\0';j++);
l2=j;
printf("L1=%d L2=%d",l1,l2);
for(i=0;i<l1;i++)
for(j=0;j<l2;j++)
{
if(name1[i]==name2[j])
{
name1[i]='-';name2[j]='-';break;}
}
printf("\n\n\n%s<--->%s",name1,name2);
for(i=0,j=0;i<l1||j<l2;i++,j++)
{
if(name1[i]!='-'&&name1[i]!='\0')
c++;
if(name2[j]!='-'&&name2[j]!='\0')
c++;
}
printf("\n\nNo of terms is:%d",c);
m=5;
for(d=0,i=0,j=0;;)
{
if(name3[d]!='/')
i++;
if(i%c==0&&name3[d]!='/')
{
name3[d]='/';
printf("\n%s",name3);
j++;
printf("\n\n%d",j);
}
if(j==m)
break;
d++;
if(d==6)
d=0;
}
printf("\n\nAnswer:::::%s",name3);
getch();
}

No comments:

Post a Comment