Preciso que um programa me diga quantas vezes o usuário digitou o caractere da barra de espaço...
http://pastebin.com/Pibyg4Jh
Olhe este link
#include <stdio.h>
#include <stdlib.h>
int main (){
char array[100] = {0};
int i;
int contador = 0;
printf("frase?");
fgets(array, 100, stdin);
for (i = 0; i < 100; i++ ){
if ( array[i] == ' '){
contador++;
}
printf("Numero de espaços: %d", contador);
getchar();
return 0;
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
http://pastebin.com/Pibyg4Jh
Olhe este link
#include <stdio.h>
#include <stdlib.h>
int main (){
char array[100] = {0};
int i;
int contador = 0;
printf("frase?");
fgets(array, 100, stdin);
for (i = 0; i < 100; i++ ){
if ( array[i] == ' '){
contador++;
}
}
printf("Numero de espaços: %d", contador);
getchar();
return 0;
}