vetor04


#include<stdio.h>
#include<conio.h>
#include <stdlib.h>

/*
**
2) Preencha 2 vetores com 10 elementos cada um. O primeiro vetor
terá números inteiros representando as idades das 10 pessoas.
O 2º vetor do tipo char representará o sexo da cada pessoa
correspondente do vetor 1. Faça um programa que teste se a
idade (vetor 1) >=18 e o sexo (vetor 2) sendo 'm' (masculino)
imprima "trazer o a reservista."
Ex.:

INDICE IDADES SEXO
0 10 F
1 15 M
2 19 M    <--- IMPRIMA TRAZER TÍTULO DE ELEITOR
3 34 F
4 33 F
5 31 M    <--- IMPRIMA TRAZER TÍTULO DE ELEITOR
6 12 M
7 15 F
8 22 M    <--- IMPRIMA TRAZER TÍTULO DE ELEITOR
9 18 F
**
*/

int main(){
    int v1[10],i,par=0,impar=0;
    char v2[10];
   
    for(i=0;i<=9;i++){
    printf("\n\t Digite a idade da pessoa:");
    scanf("%d",&v1[i]);
   
    printf("\n\t Digite o sexo da pessoa:");
    scanf(" %c",&v2[i]);
   
    }   // fim for
 
    for(i=0;i<=9;i++){  
    printf("\n\t %d:",v1[i]);
    if(v2[i] =='m' || v2[i]=='M')  printf("\t É necessario trazer a reservista!!");
    } // fim for
   
    getch();
    } // fim main

Related Posts Plugin for WordPress, Blogger...

Nenhum comentário:

Postar um comentário