Programming

posted by .

Read two numbers from the keyboard Display the menu options as follows: 1 - computes the sum of two numbers. 2 - computes the difference (first minus second). 3 - computes the product of the two numbers. 4 - if the second number is not zero, computes the quotient (first divided by second). 5 - terminates the program If the code is not equal to 1,2,3,4 or 5 - displays an error message. The program is then to display the two numbers, the integer code and the computed result to the screen. Use CASE structure in this algorithm.

  • Programming -

    int a = 10;
    int b = 5;
    int total = 0;

    printf("%d + %d = %d\n", a, b, total);
    printf("%d - %d = %d\n", a, b, total);
    printf("%d * %d = %d\n", a, b, total);
    printf("%d / %d = %d\n", a, b, total);

    /*Without an array*/
    if(var == 1)
    {
    return 1;
    }
    else if(var == 2)
    {
    return 1;
    }
    else if(var == 3)
    {
    return 1;
    }
    else if(var == 4)
    {
    return 1;
    }
    else if(var == 5)
    {
    return 1;
    }
    else
    {
    return 0;
    }


    I think that is what you want, This is just simple C code. Nothing special.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Math

    When factoring a trinomial that is in the format Ax^2 + Bx + C, the number that is represented by B should be viewed as the _____?
  2. C programming

    Enter two integers between 1 to 10 3 4 Both numbers are less than 5. The sum of two numbers is:-1081825676 The product of two numbers is:-1081825680 why are the sum and product so weird?
  3. Math 8th grade

    I NEED THESE IN ALGEBRAIC EXPRESSION!! The larger of two sums is 12 more than the smaller. Their sum is 84.Find the numbers. The sum of two numbers is 45. The first is 9 less than the second.Find the numbers. The second of two numbers …
  4. programming

    1. Develop a menu-driven program that inputs two numbers and, at the user's option, finds their sum, difference, product, or quotient
  5. Math - Algebra

    The sum of two numbers is 25. Twice the second plus 4 is equal to the first. Find the numbers. The difference of two numbers is 42. Thrice the first 4 more than the second. Find the numbers.
  6. computer programming

    Develop a menu-driven program that inputs two numbers and, at the user's option, finds their sum, difference, product, or quotient.
  7. Programming

    Develop a menu-driven program that inputs two numbers and, at the user's option, finds their sum, difference, product, or quotient.
  8. program design

    Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that computes the sum of all the whole numbers from 1 up to and including …
  9. mathematics-Algebra

    I think of two whole numbers;the product of the average of the sum and difference of the numbers and the difference of the sum and difference of the numbers is 12.if three times the first added to the second makes up 11..find the two …
  10. math

    the difference between the sum of the two numbers and the difference of the two numbers is 6.Find the larger of the two numbers if their product is 15

More Similar Questions