Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CABEÇALHO
- Arquivo: LISTA 04 - Exercicio 7.c
- Objetivo: Exibir intersecção entre dois conjuntos.
- Autor(a): Ramon Borges
- */
- #include <stdio.h>
- #define MAX 5
- int main()
- {
- int conjunto1[MAX], conjunto2[MAX], i, j;
- for(i = 0; i < MAX; i++)
- {
- printf("\nInforme o %d numero da lista 1: ", i+1);
- scanf("%d", &conjunto1[i]);
- }
- for(i = 0; i < MAX; i++)
- {
- printf("\nInforme o %d numero da lista 2: ", i+1);
- scanf("%d", &conjunto2[i]);
- }
- printf("\n***INTERSECCOES***");
- for(i = 0; i < MAX; i++)
- {
- for(j = 0; j < MAX; j++)
- if(conjunto1[i] == conjunto2[j])
- printf("\n%d", conjunto2[j]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment