3-5

#include<stdio.h>
int main(void)
{
    double valuel,value2;
    char op;
    printf("Type in an expression:");
    scanf("%lf%c%lf",&valuel,&op,&value2);
    if(op=='+')
        printf("=%.2f\n",valuel+value2);
    else if(op=='-')
        printf("=%.2f\n",valuel-value2);
    else if(op=='*')
        printf("=%.2f\n",valuel*value2);
    else if(op=='/')
        printf("=%.2f\n",valuel/value2);
    else 
        printf("Unknown operator\n");

    return 0;
}

posted @ 2013-10-05 18:38  傻子疯子捏子  阅读(106)  评论(0编辑  收藏  举报