Thursday 21 March 2013

rajnikanth amithabh bachchan common letters


#include<stdio.h>
#include<conio.h>
#define MAX 100
main()
{
      char a[]="AMITABH BACHCHAN";
      char b[]="RAJNIKANTH";
      char c[100];
   
     
      int i,j,k=0,flag=0;
     
      for(i=0;i<sizeof(a)-1;i++)
      {
             flag=0;
             for(j=0;j<k;j++)
             {
                         if(a[i]==c[j])
                                       flag=1;  
             }                
             if(flag==1)
                        continue;
             else
             {
                 for(j=0;j<sizeof(b)-1;j++)
                 {
                         if(a[i]==b[j])
                         {
                                       c[k]=a[i];
                                       k++;break;
                         }  
                 }                  
             }
      }
     
      printf("%s",c);
      getch();
         
}

No comments:

Post a Comment

Have some problem with this code? or Request the code you want if you cant find it in Blog Archive.