Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define RED "\x1b[31m"
- #define GREEN "\x1b[32m"
- #define RESET "\x1b[0m"
- int main(int argc, char const *argv[])
- {
- int hax;
- float results, addition1, addition2, times1, times2, sub1, sub2, div1, div2;
- printf(RED "1. Addition\n2. Subtraction\n3. Multiplication\n4. Division\n" RESET "\n");
- printf("Enter Choice: ");
- scanf("%d", &hax);
- if (hax == 1)
- {
- printf("You Have Entered Addition!\n\n");
- printf("Enter Number set 1 > ");
- scanf("%f", &addition1);
- printf("Enter Number set 2 > ");
- scanf("%f", &addition2);
- results = addition1 + addition2;
- printf(GREEN "%.2f + %.2f = %.2f\n", addition1, addition2, results);
- }
- else if (hax == 2)
- {
- printf("You Have Entered Subtraction!\n\n");
- printf("Enter Number set 1 > ");
- scanf("%f", &sub1);
- printf("Enter Number set 2 > ");
- scanf("%f", &sub2);
- results = sub1 - sub2;
- printf(GREEN "%.2f - %.2f = %.2f\n", sub1, sub2, results);
- }
- else if (hax == 3)
- {
- printf("You Have Entered Multiplication!\n\n");
- printf("Enter Number set 1 > ");
- scanf("%f", ×1);
- printf("Enter Number set 2 > ");
- scanf("%f", ×2);
- results = times1 * times2;
- printf(GREEN "%.2f - %.2f = %.2f\n", times1, times2, results);
- }
- else if (hax == 4)
- {
- printf("You Have Entered Division!\n\n");
- printf("Enter Number set 1 > ");
- scanf("%f", &div1);
- printf("Enter Number set 2 > ");
- scanf("%f", &div2);
- results = div1 / div2;
- printf(GREEN "%.2f - %.2f = %.2f\n", div1, div2, results);
- }
- else{
- printf("Error!\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment