Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[]) {
- char s[50];
- int nr=0,i;
- fgets(s,50,stdin);
- for(i=0; i<strlen(s); i++)
- {
- if(s[i]=='(')
- nr++;
- else
- if(s[i]==')')
- nr--;
- if(nr<0)
- break;
- }
- if(nr==0)
- printf("1");
- else
- printf("0");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement