Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int unison[200],size = 0,i,j,k,testNumber,aux;
- while (1)
- {
- printf("Entre com um elemento para o primeiro conjunto : (-1 para sair)\n");
- scanf("%d",&testNumber);
- if (testNumber == -1)
- break;
- unison[size] = testNumber;
- size++;
- }
- while (1)
- {
- printf("Entre com um elemento para o segundo conjunto : (-1 para sair)\n");
- scanf("%d",&testNumber);
- if (testNumber == -1)
- break;
- unison[size] = testNumber;
- size++;
- }
- k = size-1;
- for (i = 0; i < size; i++)
- {
- for (j = 0; j < k; j++)
- {
- if (unison[j] > unison[j+1])
- {
- aux = unison[j];
- unison[j] = unison[j+1];
- unison[j+1] = aux;
- }
- }
- k--;
- }
- printf("\n");
- for (i = 0; i < size; i++)
- {
- printf("%d\n",unison[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment