Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //IFF - Introdução à Programação
- //Slide - Página 47 - Exercício 2
- #include<stdio.h>
- #include<locale.h>
- #include<locale.h>
- int main(){
- setlocale(LC_ALL,"Portuguese");
- int vetor1[5], vetor2[5], vetor3[10], aux;
- for(int i=0;i<10;i++){
- if(i<5){
- printf("Entre com a %dª posição do vetor 1:",i+1);
- scanf("%d",&vetor1[i]);
- vetor3[i]=vetor1[i];
- }
- if(i>=5){
- printf("Entre com a %dª posição do vetor 2:",i-4);
- scanf("%d",&vetor2[i]);
- vetor3[i]=vetor2[i];
- }
- }
- for(int i=0;i<10;i++){
- for(int c=0;c<10;c++){
- if(vetor3[i]<vetor3[c]){
- aux=vetor3[i];
- vetor3[i]=vetor3[c];
- vetor3[c]=aux;
- }
- }
- }
- for(int i=0;i<10;i++) printf("%d ",vetor3[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment