How to write a C Program For Checking Arithmetic Expression Using Recursion in C Programming Language ?
Solution:
/*C Program For Checking Arithmetic Expression Using Recursion*/
#include<stdio.h>
#include <conio.h>
#include <ctype.h>
void valid();
main()
{
//clrscr();
printf("\nEnter the arithmetic expression: ");
valid();
getch();
}
void valid()
{
char a,b;
a=getche();
if (isalpha(a))
{
b=getche();
if (b=='\r')
printf("valid expression");
else if (b=='+'||b=='-'||b=='*'||b=='/')
printf("valid expression");
else
printf("invalid expression");
}
else printf("invalid");
}
Tags: C program for Checking Arithmetic Expression using recursion, c program to check the validity of an expression using stack, check for balanced parentheses in an expression in c, program for parenthesis matching using stack in c++, balancing parentheses using stack, recursion in c
c programming, online c compiler.