#1 Exibe os numeros Comuns digitados. Ter Out 22, 2013 2:36 am
Admin
Admin
Esse código tem a função de exibir todos os números comuns digitados nos elementos X E Y.
This code has the function of displaying all the numbers entered in the common elements X and Y.
- Código:
#include <stdlib.h>
#include <iostream.h>
int main()
{
int x[10],y[10],z[10],i,j;
for (int i=0; i<10; i++)
{
cout<<"Vetor x Digite o elemento da posicao ",i;
cin>>x[i];
}
for (int i=0; i<9; i++)
{
cout<<"Vetor y Digite o elemento da posicao ",i;
cin>>y[i];
}
for (int i=0; i<10; i++)
{
for (int j=0; j<9; j++)
{
if (x[i]==y[j])
{
z[i]=x[i];
cout<<"\Numeros comuns:"<<z[i];
}
}
}
system("pause");
}