Solve Expressions 2

This commit is contained in:
2021-04-25 16:40:26 +05:30
parent b190456845
commit 376b613e9c
3 changed files with 22 additions and 1 deletions

View File

@@ -11,3 +11,4 @@
|9 | DataTypeSize.c | DataTypeSize.exe | WAP to check size of following data types: char,int,float, double | |9 | DataTypeSize.c | DataTypeSize.exe | WAP to check size of following data types: char,int,float, double |
|10 | BitwiseOperators.c | BitwiseOperators.exe | WAP to perform bitwise operators | |10 | BitwiseOperators.c | BitwiseOperators.exe | WAP to perform bitwise operators |
|11 | LogicalOperator.c | LogicalOperator.exe | WAP for logical operators | |11 | LogicalOperator.c | LogicalOperator.exe | WAP for logical operators |
|12 | SolveExpression2.c | SolveExpression2.exe | WAP to solve given expression "ans=a + b - (c*d) / f + g" |

20
SolveExpressions2.c Normal file
View File

@@ -0,0 +1,20 @@
// WAP to solve given expression.
// ans=a + b - (c*d) / f + g
void main() {
int a, b, c, d, f, g, ans;
printf("Enter the value of a & b\n");
scanf("%d,%d", &a, &b);
printf("\nEnter the value of c & d\n");
scanf("%d,%d", &c, &d);
printf("\nEnter the value of f & g\n");
scanf("%d,%d", &f, &g);
ans == a + b - (c*d) / f + g;
printf("\n The answer to a + b - (c*d) / f + g = %d", ans);
}

BIN
SolveExpressions2.exe Normal file

Binary file not shown.