Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main() {
- char *str;
- str = (char*)calloc(100,sizeof(char));
- fgets(str,100,stdin);
- bool fl1 = false,fl2 = false;
- int t1 = 0, t2 = 0;
- for (int i = 0; i < strlen(str); i++) {
- if (!fl1 && str[i] >= '0' && str[i] <= '9') {
- fl1 = true; t1 = i;
- }
- if (str[i] == '.' && fl1) {
- t2 = i;
- }
- if (fl1) {
- t2 = i;
- }
- if (str[i] <= '0' && str[i] >= '9' && str[i] != '.') {
- fl1 = false, fl2 = false;
- }
- }
- for (int i = t1; i <= t2; i++) printf("%c",str[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement