Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /*
- * File: main.c
- * Author: a16007
- *
- * Created on 2 de Maio de 2016, 08:15
- */
- #include <stdio.h>
- #include <stdlib.h>
- /*
- *
- */
- int main() {
- int f, i, j, m;
- float salf, salm, salt, porcent, summ, sumf;
- char s;
- i=0;
- sumf;
- summ;
- salm=0;
- salf=0;
- salt=0;
- while(i<5){
- printf("Qual o sexo do funcionário? [M]masculino ou [F]feminino?\n ");
- scanf(" %c", &s);
- while(s!='m' && s!='M' && s!='f' && s!='F'){
- printf("Entrada inválida.\n");
- printf("Entre com [M]masculino ou [F]feminino\n");
- scanf(" %c", &s);
- }
- if(s=='M' || s=='m'){
- printf("Qual o salário do funcionário?\n");
- scanf("%f",&salm);
- while(salm<=0){
- printf("Entrada inválida.\n");
- printf("Entre com um salário maior que zero\n");
- scanf("%f", &salm);
- }
- summ=salm+summ;
- m++;
- }
- if(s=='F'|| s=='f'){
- printf("Qual o salário da funcionária?\n");
- scanf("%f",&salf);
- while(salf<=0){
- printf("Entrada inválida.\n");
- printf("Entre com um salário maior que zero\n");
- scanf("%f", &salf);
- }
- sumf=salf+sumf;
- f++;
- }
- i++;
- }
- salt=sumf+summ;
- porcent=(sumf/salt)*100;
- printf("O salário total dos funcionários é de %.2f reais:" ,salt);
- printf("A porcentagem salarial das mulheres é de %.2f porcento." ,porcent);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement