SHARE
TWEET

string without digits

a guest Dec 8th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     char str[150];
  6.  
  7.     int i, j;
  8.  
  9.     printf("Enter the string with digits\n");
  10.  
  11.     gets(str);
  12.  
  13.     for(i = 0; str[i] != '\0'; ++i)
  14.     {
  15.         while (!( (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || str[i] == '\0') )
  16.         {
  17.             for(j = i; str[j] != '\0'; ++j)
  18.             {
  19.                 str[j] = str[j+1];
  20.             }
  21.            str[j] = '\0';
  22.         }
  23.     }
  24.     printf("The string after deleting the digits\n");
  25.  
  26.     puts(str);
  27.  
  28.     return 0;
  29. }
  30. //Happy Coding
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top