Advertisement
Guest User

Contador de espaços

a guest
Nov 19th, 2014
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main (){
  5.  
  6.     char frase[101];
  7.     int i;
  8.     int contador = 0;
  9.    
  10.     printf("Informe a frase: ");
  11.     gets(frase);
  12.  
  13.     for (i = 0; i < 101; i++){
  14.        if ( frase[i] == ' '){
  15.           contador++;
  16.        }
  17.     }
  18.    
  19.     printf("Numero de espaços: %d", contador);
  20.  
  21.     getchar();
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement