generated from ibm-developer-skills-network/coding-project-template
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Description
#include<stdio.h>
int main()
{
char op;//op is operator
float first, second;
printf("Enter your operator(+,-,/,*)=\n");
scanf("%c",&op);
printf("________________________________________\n");
printf(" |\n");
printf("Enter first number=");
scanf("%f",&first);
printf(" |\n");
printf("Enter second number=");
scanf("%f",&second);
printf(" |\n");
printf("________________________________________\n");
switch (op){
case '+':
{
printf("the addition is= |%f", first+second);
break;
}
case '-':
{
printf("the substraction is=%f", first-second);
break;
}
case '*':
{
printf("the multiplication is=%f", first*second);
break;
}
case '/':
{
printf("the division is=%f", first/second);
break;
}
default:
{
printf("invalid operation");
}
}
}
Metadata
Metadata
Assignees
Labels
No labels