Advertisement
Guest User

string without digits

a guest
Dec 8th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement