-
-
Save dan49075/b26ca718937635e2f7a7 to your computer and use it in GitHub Desktop.
| //Calculator program | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main() | |
| { | |
| int menu; //Variable for the number the user inputs | |
| float num1, num2, result; //Float variables for the user input and output, used floats in case the user enters e.g. 14.7 | |
| printf("Enter a number from the list below\n\n"); | |
| printf("1. Addition\n"); //Calculator menu, user must enter a value from 1 - 4 for the program to work | |
| printf("2. Subtraction\n"); | |
| printf("3. Multiplication\n"); | |
| printf("4. Division\n\n"); | |
| printf("Enter number: "); //User input for the calculator menu | |
| scanf("%d", &menu); | |
| printf("\n"); | |
| switch(menu) //switch statement for menu | |
| { | |
| case 1: | |
| printf("You entered Addition\n\n"); | |
| printf("Enter first number: "); //User input for first number | |
| scanf("%f", &num1); | |
| printf("Enter second number: "); //User input for second number | |
| scanf("%f", &num2); | |
| printf("\n"); | |
| result = num1 + num2; //Addition calculation | |
| printf("%.2f + %.2f = %.2f\n", num1, num2, result); //Addition output | |
| break; | |
| case 2: | |
| printf("You entered Subtraction\n\n"); | |
| printf("Enter first number: "); //User input for first number | |
| scanf("%f", &num1); | |
| printf("Enter second number: "); //User input for second number | |
| scanf("%f", &num2); | |
| printf("\n"); | |
| result = num1 - num2; //Subtraction calculation | |
| printf("%.2f - %.2f = %.2f\n", num1, num2, result); //Subtraction output | |
| break; | |
| case 3: | |
| printf("You entered Multiplication\n\n"); | |
| printf("Enter first number: "); //User input for first number | |
| scanf("%f", &num1); | |
| printf("Enter second number: "); //User input for second number | |
| scanf("%f", &num2); | |
| printf("\n"); | |
| result = num1 * num2; //Multiplication calculation | |
| printf("%.2f * %.2f = %.2f\n", num1, num2, result); //Multiplication Output | |
| break; | |
| case 4: | |
| printf("You entered Division\n\n"); | |
| printf("Enter first number: "); //User input for first number | |
| scanf("%f", &num1); | |
| printf("Enter second number: "); //User input for first number | |
| scanf("%f", &num2); | |
| printf("\n"); | |
| result = num1 / num2; //Division calculation | |
| printf("%.2f / %.2f = %.2f\n", num1, num2, result); | |
| break; | |
| default: | |
| printf("Enter correct number e.g 1 - 4\n"); //Outputted if the user enters a value other than 1 - 4 | |
| break; | |
| } | |
| return 0; | |
| } | |
| //End of code |
Inat Box https://inatboxsapk.com.tr/blog/ is a popular streaming application that allows users to watch live TV channels, movies, and series from around the world. It offers a wide range of entertainment content in one place with easy navigation. Many users prefer Inat Box for its free access and compatibility with Android devices.Select 43 more words to run Humanizer.
PicsArtOnline is an easy-to-use online photo editor that helps you create stunning images in just a few clicks. With powerful editing tools, creative filters, stickers, and effects, it’s perfect for enhancing photos for social media, designs, or personal projects—no installation required, just fast and smooth editing right in your browser.
Checking your SASSA status for R350 payment dates lets you see if your Social Relief of Distress (SRD) grant application is approved and when the monthly R350 (now R370) payment is scheduled.
7brewcoffeesmenus offers a broad selection of made-to-order drinks such as coffee, cold brew, energy drinks, teas, and smoothies, all served through a fast drive-thru. Each beverage can be personalized with different flavors, milk choices, and sweetness preferences. With rotating seasonal options alongside popular staples like shakes and specialty coffees, the menu caters to a wide range of tastes.
Le Desherbant Glyphosate est efficace pour éliminer les adventices, mais son utilisation doit être raisonnée et encadrée.
Nice and clean implementation—simple calculators like this are great for understanding core logic and structuring operations clearly. It’s a solid base that could easily be extended with more advanced functions or better input handling.
If you ever plan to expand it, adding features similar to a scientific calculator free version (like exponents, trig functions, etc.) could make it even more useful.
A snow calculator estimates possible snowfall by using weather forecasts and atmospheric conditions. It helps people prepare for winter weather by giving a quick idea of how much snow to expect.