ramontricolor12

LISTA 04 - Exercício 07

Jul 8th, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. /* CABEÇALHO
  2.    Arquivo: LISTA 04 - Exercicio 7.c
  3.    Objetivo: Exibir intersecção entre dois conjuntos.
  4.    Autor(a): Ramon Borges
  5.  */
  6.  
  7. #include <stdio.h>
  8. #define MAX 5
  9. int main()
  10. {
  11.     int conjunto1[MAX], conjunto2[MAX], i, j;
  12.  
  13.     for(i = 0; i < MAX; i++)
  14.     {
  15.         printf("\nInforme o %d numero da lista 1: ", i+1);
  16.         scanf("%d", &conjunto1[i]);
  17.     }
  18.     for(i = 0; i < MAX; i++)
  19.     {
  20.         printf("\nInforme o %d numero da lista 2: ", i+1);
  21.         scanf("%d", &conjunto2[i]);
  22.     }
  23.     printf("\n***INTERSECCOES***");
  24.     for(i = 0; i < MAX; i++)
  25.     {
  26.         for(j = 0; j < MAX; j++)
  27.             if(conjunto1[i] == conjunto2[j])
  28.                 printf("\n%d", conjunto2[j]);
  29.     }
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment