Prime no, String and Matching parenthesis
Anoniem
//for Prime number we can use this piece of code here we are checking until j*j=n instead of //all the numbers to reduce the time complexity. #include int main() { int num1, num2, flag_var, i, j; scanf("%d %d", &num1, &num2); for(i=num1+1; i 21/2 =10 { if(i%j==0) { flag_var=1; break; } } if(flag_var==0) printf("%d\n",i); } return 0; } And for matching parenthesis We can use Stack if(i == '(')){ push('(');)}else{pop();}