Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<locale.h>
- int main( ){
- setlocale(LC_ALL, "Portuguese");
- int vet[10], vetp[10], veti[10], i, j = 0;
- printf("\t\tPreenchendo o vetor\n\n");
- for(i = 0; i <= 10; i++){
- printf("\nDigite um número: ");
- scanf("%d", &vet[i]);
- }
- system("cls");
- for(j = 0; j <= 10; j++){
- if(vet[j] % 2 == 0) //pega o resto da divisão inteira e compara com 0
- vetp[j] = vet[j];
- }
- else{
- veti[j] = vet[j];
- }
- }
- printf("\n\n\t\tVetor inicial\t\tVetor par\t\tVetor impar\n\n");
- for(j = 0; j <= 10; j++){
- printf("\t\t%d\t\t%d\t\t%d\n", vet[j], vetp[j], veti[j]);
- }
- puts("\n\n");
- system("pause");
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement