Lets code a calculator with C programming! 🖩 @BroCodez
Lets code a calculator with C programming! 🖩  @BroCodez
Uploaded March 2025 | Updated September 2026, 1 week ago
#coding #programming #cprogramming

// CALCULATOR PROGRAM

char operator = '\0';
double num1 = 0.0;
double num2 = 0.0;
double result = 0.0;

printf("Enter the first number: ");
scanf("%lf", &num1);

printf("Enter the operator (+ - * /): ");
scanf(" %c", &operator); // clear \n from input buffer

printf("Enter the second number: ");
scanf("%lf", &num2);

switch(operator){
case '+':
result = num1 + num2;
break;
case '-':
result = num1 - num2;
break;
case '*':
result = num1 * num2;
break;
case '/':
if(num2 == 0){
printf("You can't divide by zero!\n");
}
else{
result = num1 / num2;
}
break;
default:
printf("Invalid operator\n");
}

printf("result: %.4lf", result);

return 0;
Lets code a calculator with C programming! 🖩Learn typedef in 5 minutes! 📛Learn to reshape NumPy arrays in 4 minutes! ↔️Learn Java AGGREGATION in 9 minutes! 🏫Learn the STATIC keyword in 8 minutes! 🤝Nested if statements are easy! 🎟️Realloc in C explained easy! 🚢Learn how to enter user input in C! ⌨️Code a C digital clock in 10 minutes! ⌚Code a dice roller program with Java! 🎲Learn hexadecimal in 0x79 seconds #coding #computerscience #programmingLearn enums in 8 minutes! 📅
Bro Code |

Let's code a calculator with C programming! 🖩

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER