Advertisement
Sai_Bot

trab1

May 2nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.68 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /*
  8.  * File:   main.c
  9.  * Author: a16007
  10.  *
  11.  * Created on 2 de Maio de 2016, 08:15
  12.  */
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16.  
  17. /*
  18.  *
  19.  */
  20. int main() {
  21.  
  22.     int f, i, j, m;
  23.     float salf, salm, salt, porcent, summ, sumf;
  24.     char s;
  25.    
  26.     i=0;
  27.     sumf;
  28.     summ;
  29.     salm=0;
  30.     salf=0;
  31.     salt=0;
  32.     while(i<5){
  33.     printf("Qual o sexo do funcionário? [M]masculino ou [F]feminino?\n ");
  34.     scanf(" %c", &s);
  35.     while(s!='m' && s!='M' && s!='f' && s!='F'){
  36.         printf("Entrada inválida.\n");
  37.         printf("Entre com [M]masculino ou [F]feminino\n");
  38.         scanf(" %c", &s);
  39.     }
  40.         if(s=='M' || s=='m'){
  41.             printf("Qual o salário do funcionário?\n");
  42.             scanf("%f",&salm);
  43.             while(salm<=0){
  44.                 printf("Entrada inválida.\n");
  45.                 printf("Entre com um salário maior que zero\n");
  46.                 scanf("%f", &salm);
  47.                 }
  48.             summ=salm+summ;
  49.             m++;
  50.          }
  51.         if(s=='F'|| s=='f'){
  52.             printf("Qual o salário da funcionária?\n");
  53.             scanf("%f",&salf);
  54.             while(salf<=0){
  55.                 printf("Entrada inválida.\n");
  56.                 printf("Entre com um salário maior que zero\n");
  57.                 scanf("%f", &salf);
  58.                 }
  59.             sumf=salf+sumf;
  60.             f++;
  61.         }
  62.         i++;
  63.     }
  64.     salt=sumf+summ;
  65.     porcent=(sumf/salt)*100;
  66.     printf("O salário total dos funcionários é de %.2f reais:" ,salt);
  67.     printf("A porcentagem salarial das mulheres é de %.2f porcento." ,porcent);
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement