用c语言编写一个加减乘除的程序
时间: 2023-02-28 09:01:27 浏览: 129
c语言程序加减乘除
我可以为您提供一个简单的C语言程序,它可以实现加减乘除的功能:#include <stdio.h>int main()
{
float num1, num2, result;
char operator;
printf("Enter two numbers: ");
scanf("%f%f", &num1, &num2);
printf("Enter an operator (+, -, *, /): ");
scanf(" %c", &operator);
switch(operator)
{
case '+':
result = num1 + num2;
break;
case '-':
result = num1 - num2;
break;
case '*':
result = num1 * num2;
break;
case '/':
result = num1 / num2
阅读全文