Aula C, Salário
Atividade para exibir salário, aumento e novo salário
Código
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <math.h>
int main()
{
setlocale(LC_ALL,"portuguese");
float x;
printf("Insira o valor do salário atual: \n");
scanf("%f", &x);
if ( x > 0 && x <= 400){
float z = 0.15;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 400 && x <= 800){
float z = 0.12;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 800 && x <= 1200){
float z = 0.10;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 1200 && x <= 2000){
float z = 0.07;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 2000){
float z = 0.04;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else{}
printf("Você é pobre");
return 0;
}
Código
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <math.h>
int main()
{
setlocale(LC_ALL,"portuguese");
float x;
printf("Insira o valor do salário atual: \n");
scanf("%f", &x);
if ( x > 0 && x <= 400){
float z = 0.15;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 400 && x <= 800){
float z = 0.12;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 800 && x <= 1200){
float z = 0.10;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 1200 && x <= 2000){
float z = 0.07;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else if ( x > 2000){
float z = 0.04;
float y = x + x * z;
float r = x * z;
printf("Novo salário: %.2f \n Reajuste ganho: %.2f \n Percentual de reajuste ganho: %.2f", y,z,r);
} else{}
printf("Você é pobre");
return 0;
}
Comentários
Postar um comentário