How I can eliminate integers and take the only character from the input line and reverse it in C. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I can eliminate integers and take the only character from the input line and reverse it in C.

If this is input 57o87l7l88e0H the output must be = hello

1st Feb 2021, 3:21 AM
PRAJWAL
PRAJWAL - avatar
7 Answers
+ 2
You can iterate through the string and check if a character is an integer with the isdigit() function of ctype.h https://code.sololearn.com/cTg1hH3VjUMJ/?ref=app
1st Feb 2021, 3:37 PM
David Martínez Castañón
David Martínez Castañón - avatar
+ 1
Ok thanks I will try it.
1st Feb 2021, 3:34 AM
PRAJWAL
PRAJWAL - avatar
+ 1
Thank you buddy 👍
1st Feb 2021, 3:39 PM
PRAJWAL
PRAJWAL - avatar
0
What about special characters%,&,/ how I can eliminate them?
1st Feb 2021, 3:44 PM
PRAJWAL
PRAJWAL - avatar
0
As Shahzad said you can use isalpha instead of !isdigit
1st Feb 2021, 3:46 PM
David Martínez Castañón
David Martínez Castañón - avatar
0
It depends on if you want to remove only digits or also symbols
1st Feb 2021, 3:47 PM
David Martínez Castañón
David Martínez Castañón - avatar
0
Thank you both.it works
1st Feb 2021, 3:52 PM
PRAJWAL
PRAJWAL - avatar