Advertisement
imedvedev

Untitled

Nov 11th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h> // есть волшебная либа, где есть функция isdigit()
  4.  
  5. int main(){
  6.    
  7.     int i;
  8.     int result = 0;
  9.     char str[256];
  10.    
  11.     printf("Введите строку\n");
  12.     gets(str);
  13.    
  14.     for (i=0; i<strlen(str); i++){
  15.         if (isdigit(str[i])){
  16.             result++;
  17.         }
  18.     }
  19.    
  20.     printf("В вашей строке: %d циферок", result);
  21.    
  22.     return 0;
  23.    
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement