moranguinho

ex7 ED3

Mar 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /* 7) Implemente o operador OU exclusivo.
  2. Por exemplo: Ler a informação se uma pessoa recebe vale alimentação (S/N) e se recebe
  3. auxilio transporte (S/N). Informar que a pessoa está regularizada se recebe um e somente
  4. um desses benefícios. */
  5. #include <stdio.h>
  6. int main(void)
  7. {
  8. char vale_a, aux_t;
  9.  
  10. printf("Responda com S/s ou N/n se voce recebe vale alimentacao: ");
  11. scanf("%c", &vale_a);
  12. fflush(stdin); // retira os caracteres q estao armazenados na memoria do teclado
  13. printf("Responda com S/s ou N/n se voce recebe auxilio transporte: ");
  14. scanf("%c", &aux_t);
  15.  
  16. if (((vale_a == 's'|| vale_a=='S') && (aux_t=='n' || aux_t=='N')) || ((vale_a=='n' || vale_a=='N') && (aux_t=='s' || aux_t=='S'))){
  17. printf("A pessoa esta regularizada");
  18. }
  19. else{
  20. printf("A pessoa nao esta regularizada");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment