/* Program in C language to find common Alphabets!! */
/*
c1 = {'$','8','5','a','7','t','8','e'};
c2 = {'1','t','6','0','%','a','7','9'};
*/
#include <stdio.h>
int main()
{
// c1 and c2 character array
char c1[10] = {'$','8','5','a','7','t','8','e'};
char c2[10] = {'1','t','6','0','%','a','7','9'};
int i, j;
// looping till number of elements
for(i=0;i<8;i++) {
for(j=0;j<8;j++) {
int main()
{
// c1 and c2 character array
char c1[10] = {'$','8','5','a','7','t','8','e'};
char c2[10] = {'1','t','6','0','%','a','7','9'};
int i, j;
// looping till number of elements
for(i=0;i<8;i++) {
for(j=0;j<8;j++) {
// comparing both
if(c1[i]==c2[j]) {
// comparing alphabets under c1 and c2
printf("www.techterabyte.com");
printf("Elements common in both arrays:");
if(c1[i]>='a'&&c1[i]<='z') {
printf("\nElement = %c",c[i]);
}
}
}
}
return(0);
}
if(c1[i]>='a'&&c1[i]<='z') {
printf("\nElement = %c",c[i]);
}
}
}
}
return(0);
}
Output
www.techterabyte.com
Elements common in both arrays:
Element = a
Element = t
Elements common in both arrays:
Element = a
Element = t
No comments:
Post a Comment