15. Given are two linear arrays of integers, one containing 20 elements and the
other containing 15 elements. After reading data to obtain values for all items
in each array, print the values of only those integers that appear in both the
arrays.
#include
#include
void main()
{
int a[20],b[15],i,j;
clrscr();
for(i=0;i<20;i++)
{
printf("\nEnter the value%d of array1:",i+1);
scanf("%d",&a[i]);
}
for(i=0;i<15;i++)
{
printf("\nEnter the value%d of array2:",i+1);
scanf("%d",&b[i]);
}
for(i=0;i<20;i++)
{
for(j=0;j<15;j++)
{
if(a[i]==b[j])
{
printf("\n%d",a[i]);
}
}
}
getch();
}
/*Output
Enter the value13 of array1:13
Enter the value14 of array1:14
Enter the value15 of array1:15
Enter the value16 of array1:16
Enter the value17 of array1:17
Enter the value18 of array1:18
Enter the value19 of array1:19
Enter the value20 of array1:20
Enter the value1 of array2:21
Enter the value2 of array2:22
Enter the value3 of array2:23
Enter the value4 of array2:25
Enter the value5 of array2:26
Enter the value6 of array2:27
Enter the value7 of array2:28
Enter the value8 of array2:29
Enter the value9 of array2:1
Enter the value10 of array2:2
Enter the value11 of array2:3
Enter the value12 of array2:45
Enter the value13 of array2:46
Enter the value14 of array2:48
Enter the value15 of array2:69
1
2
3
*/
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Tuesday, December 30, 2008
Given are two linear arrays of integers write a program print the values of only those integers that appear in both the arrays
Posted by ars at 12:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment