I wrote this simple calculator and I want to know if there is any problems in it or if there is any way to enhance the code and make it simpler and easier and I also want to know if I'm starting to get into the intermediate level instead of beginners level and thank you
#include<stdio.h>
void main()
{
int mode, n1, n2;
float num1, num2, rslt;
char op;
puts("a simple calculator");
printf("enter the first number : ");
scanf("%f", &num1);
printf("which operation you want '+ - / * or mode' : ");
scanf(" %c", &op);
printf("enter the second number : ");
scanf("%f", &num2);
switch(op)
{
case '+' :
rslt = num1 + num2;
printf("\n %f + %f = %.3f\n\n", num1, num2, rslt);
break;
case '-' :
rslt = num1 - num2;
printf("\n %f - %f = %.3f\n\n", num1, num2, rslt);
break;
case '*' :
rslt = num1 * num2;
printf("\n%f * %f = %.3f\n\n", num1, num2, rslt);
break;
case '/' :
rslt = num1 / num2;
printf("\n%f / %f = %.3f\n\n", num1, num2, rslt);
break;
case '%' :
n1 = num1;
n2 = num2;
switch(n1%n2)
{
case 0 :
printf("\n%d can be devided by %d\n\n", n1, n2);
break;
case 1 :
printf("\n%d can not be devided by %d\n\n", n1, n2);
break;
}
break;
default :
printf("\ninvalid input\n\n");
}
}