Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- char str1[256] = { 0 };
- char str2[256] = { 0 };
- int x, y;
- char c = 0;
- fscanf(stdin, "%255s", str1);
- if ((sscanf(str1, "(%d%c", &x, &c) == 2) && (c == ')')){
- printf("It is a number\n");
- } else if ((sscanf(str1, "[%d%c", &x, &c) == 2) && (c == ']')){
- printf("It is a number\n");
- } else {
- printf("It is NOT a number\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement