Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include <stdlib.h>
- int main(void){
- int kou1;
- char enzan = 0;
- int kou2;
- char eq;
- int ans = 0;
- scanf( "%d%c%d%c", &kou1, &enzan, &kou2, &eq );
- if (enzan == 0x2b){
- ans = kou1 + kou2;
- } else if (enzan == 0x2d){
- ans = kou1 - kou2;
- } else if (enzan == 0x2a){
- ans = kou1 * kou2;
- } else if (enzan == 0x2f){
- ans = kou1 / kou2;
- } else {
- printf("Error! Please check your fomula.\n");
- exit(0);
- }
- printf("%d\n",ans);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement