Blog Moved

This website completely moved to new domain. For latest content, visit www.programmingposts.com

Search This Blog

9 Mar 2013

C PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP


C PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP :

#include<stdio.h>
void main()
{
    float value1,value2;
    char operator;
    printf("\n >>> PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP <<< \n");
    printf("\n Enter Your Expression : ");
    scanf("%f %c %f",&value1,&operator,&value2);
    switch(operator)
    {
        case '+' : printf("\n Addition Result  is :  %f \n",value1+value2);
            break;
        case '-' : printf("\n Subtraction Result  is : %f \n",value1-value2);
            break;
        case '*' : printf("\n Multiplication Result  is : %f \n",value1*value2);
            break;
        case '/' : printf("\n Division Result is : %f \n",value1/value2);
            break;
        default : printf("\n Unknown operator");
            break;
    }
    getch();
}

Output :


visit :  C Program to Show the Operations of Arithmetic Operators 

2 comments: