# switch-arithmetic

`switch-arithmetic`

Posted by xzzjyn 2018-09-09 17:11:02

```\$a = 5;
switch(\$a)
{
case 4: echo "d";
break;
case 5: echo "e";
break;
case 6: echo "f";
break;
default:
echo "non-def";
break;
}```

```/* Here is the code */

#include <stdio.h>

void sum(float a, float b){
float c = a+b;
printf("
}

void subs(float a, float b){
float c = a/b;
printf("
Substraction is : %f", c);
}

void multi(float a, float b){
float c = a/b;
printf("
Multiplication is : %f", c);
}

void divs(float a, float b){
float c = a/b;
printf("
Division is : %f", c);
}

int main()
{
char choice;

printf("
printf("
S-subtraction-Difference");
printf("
M-Multiplication-Product");
printf("
D-Division-Quotient");

printf("
scanf("%c",&choice);

float a, b, c;
printf("
Enter a : ");
scanf("%f", &a);
printf("
Enter b : ");
scanf("%f", &b);

switch(choice){
case 'A': sum(a, b); break;
case 'B': subs(a, b); break;
case 'C': multi(a, b); break;
case 'D': divs(a, b); break;
default: printf("
Invalid Choice !!");
}

return 0;
}```

```<?php
\$a=2;
\$b=7;
\$c=2;
\$r=0;\$q=0;
'Mult
\$r=\$a*\$b;
echo \$a,\$b,\$r;
'Sum
\$r=\$a+\$b;
echo \$a,\$b,\$r;
'Sub
\$r=\$a-\$b;
echo \$a,\$b,\$r;
'Div Qus Rem
\$r=\$a/\$b;
echo \$a,\$b,\$r;
\$q=\$a%\$b;
echo \$a,\$b,\$r;
?>```