Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main() {
- char result[1000];
- char entrada[100];
- int marias = 0;
- int i = 0;
- for(i = 0; i < 20; i++) {
- printf("Dame el nombre %i", i);
- gets(entrada);
- if(entrada[(unsigned)strlen(entrada) - 1] == 's' || entrada[(unsigned)strlen(entrada) - 1] == 'S') {
- strncat(result, entrada, strlen(entrada));
- strncat(result, " ", 1);
- }
- if(strcmp(entrada, "maria") == 0)
- marias++;
- }
- printf("Los nombres que terminan con s son: %s", result);
- printf("El porcentaje de marias es: %d", (marias/20)*100);
- return 0;
- }
Add Comment
Please, Sign In to add comment