sdnu1034

xiaoxiao2021-02-28  26

1034.简易计算器

Time Limit: 1000 MS    Memory Limit: 32768 KB Total Submission(s): 487    Accepted Submission(s): 224

Description

请你设计一个简易计算器,要求输入两个数和他们的运算符(只限+ - *),求出和。

Input

数字A 运算符 数字B,如10 + 30

Output

输入式子的运算结果

Sample Input

10 + 30

Sample Output

40

Source

SDNU ACM-ICPC 2012 Training

#include<stdio.h> int main() {     char c;     int a,b;     scanf("%d %c %d",&a,&c,&b);     switch(c)     {         case '+':printf("%d\n",a+b);break;         case '-':printf("%d\n",a-b);break;         case '*':printf("%d\n",a*b);break;     }     return 0; }

转载请注明原文地址: https://www.6miu.com/read-1400216.html

最新回复(0)