Input Format
In a single line, you will be given the string.
Constraints
- The string contains exactly characters of the form
x+y
orx-y
.
Output Format
In a single line, print the result of the operation.
Sample Input 0
0+1
Sample Output 0
1
Sample Input 1
0-3
Sample Output 1
-3
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main() {
int a,b;
char c;
scanf("%d%c%d",&a,&c,&b);
switch(c)
{
case '-':printf("%d",a-b);
break;
case '+':printf("%d",a+b);
break;
}
return 0;
}
Please do comment If u have any Queries!
No comments:
Post a Comment