/*Um funcionário de uma empresa recebe, anualmente, aumento salarial. Sabe-se que:
1) esse funcionário foi contratado em 2005 com salário inicial de R$ 1.000,00;
2) em 2006 ele recebeu aumento de 1,5% sobre seu salário inicial; e
3) a partir de 2007, os aumentos salariais sempre corresponderam ao dobro do percentual do ano anterior.
Faça um algoritmo que determine o salário atual desse funcionário.*/
#include <stdio.h>
int main( void ) {
float salario = 1000 , aumento = 1.5 / 100 ;
int i, anoIni = 2005 , anoFim = 2010 ;
//scanf("%i", &anoFim);
for ( i = anoIni + 1 ; i <= anoFim; i++ ) {
salario = salario + ( salario * aumento) ;
printf ( "Salario em %i: %.2f - aumento de %.1f\% \n " , i
, salario
, aumento
* 100 ) ; aumento = 2 * aumento;
}
printf ( "Salario final: %.2f" , salario
) ;
return 0 ;
}
LypVbSBmdW5jaW9uw6FyaW8gZGUgdW1hIGVtcHJlc2EgcmVjZWJlLCBhbnVhbG1lbnRlLCBhdW1lbnRvIHNhbGFyaWFsLiBTYWJlLXNlIHF1ZTogCjEpIGVzc2UgZnVuY2lvbsOhcmlvIGZvaSBjb250cmF0YWRvIGVtIDIwMDUgY29tIHNhbMOhcmlvIGluaWNpYWwgZGUgUiQgMS4wMDAsMDA7IAoyKSBlbSAyMDA2IGVsZSByZWNlYmV1IGF1bWVudG8gZGUgMSw1JSBzb2JyZSBzZXUgc2Fsw6FyaW8gaW5pY2lhbDsgZSAKMykgYSBwYXJ0aXIgZGUgMjAwNywgb3MgYXVtZW50b3Mgc2FsYXJpYWlzIHNlbXByZSBjb3JyZXNwb25kZXJhbSBhbyBkb2JybyBkbyBwZXJjZW50dWFsIGRvIGFubyBhbnRlcmlvci4gCgpGYcOnYSB1bSBhbGdvcml0bW8gcXVlIGRldGVybWluZSBvIHNhbMOhcmlvIGF0dWFsIGRlc3NlIGZ1bmNpb27DoXJpby4qLwoKI2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CglmbG9hdCBzYWxhcmlvID0gMTAwMCwgY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