We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <stdio.h>
int main() { char operator; float num1, num2;
printf("Enter an operator (+, -, *, /): "); scanf("%c", &operator); printf("Enter two numbers: "); scanf("%f %f", &num1, &num2); switch(operator) { case '+': printf("%.2f + %.2f = %.2f", num1, num2, num1 + num2); break; case '-': printf("%.2f - %.2f = %.2f", num1, num2, num1 - num2); break; case '*': printf("%.2f * %.2f = %.2f", num1, num2, num1 * num2); break; case '/': if(num2 != 0) printf("%.2f / %.2f = %.2f", num1, num2, num1 / num2); else printf("Error! Division by zero."); break; default: printf("Error! Operator is not correct."); } return 0;
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
#include <stdio.h>
int main() {
char operator;
float num1, num2;
}
The text was updated successfully, but these errors were encountered: