Advertisement
darkstar97

tipo sanguíneo

Jun 8th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. //tipo sanguíneo
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <locale.h>
  5.  
  6. int main(){
  7.     int peso, x=0;
  8.     char nome[20], ts[5], doa;
  9.     setlocale(0, "Portuguese");
  10.    
  11.     do{
  12.     printf("Digite seu nome, seu peso em kg e seu tipo sanguíneo, respectivamente:\n");
  13.     scanf(" %s %d %s", nome, &peso, ts);
  14.    
  15.     printf("você doou sangue nos últimos 6 meses? s/n\n");
  16.     scanf(" %c", &doa);//é importante colocar o espaço antes do "%c" aqui
  17.    
  18.    
  19.     if((peso>=50)&&(doa=='n')){
  20.         printf("%s tem o tipo sanguíneo %s e pode doar sangue\n\n", nome, ts);
  21.     }
  22.     else{
  23.         printf("%s não atende os requisitos para doação\n\n", nome);
  24.     }
  25.     x++;
  26.     }
  27.     while(x<5);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement