Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- /* Deixa a string minuscula */
- char *min(char *str) {
- int i;
- for(i = 0; i < strlen(str); i++) {
- str[i] = tolower(str[i]);
- }
- return str;
- }
- int main(void) {
- int qtd_pessoa, qtd_total=0;
- char continuar[20];
- float valor = 0;
- scanf("%d", &qtd_pessoa);
- valor += (qtd_pessoa+1)*14;
- qtd_total += qtd_pessoa+1;
- scanf(" %[^\n]s", continuar);
- strcpy(continuar, min(continuar));
- while(strcmp(continuar, "sair") != 0) {
- scanf("%d", &qtd_pessoa);
- scanf(" %[^\n]s", continuar);
- valor += (qtd_pessoa+1)*14;
- qtd_total += qtd_pessoa+1;
- strcpy(continuar, min(continuar));
- }
- printf("%d\n%.2f\n", qtd_total, valor);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement