Write a single program that prints the results of two


Please see the instructions below. The feedback received from the code I wrote and submitted was "The code only carries out 2 of the 4 required calculations using expressions"

Please see the included code below and let me know what I'm missing and how to fix.

Thanks

Instructions

Write a single program that prints the results of two arithmetic expressions using integers and the results of two floating-point calculations. Print out both the arithmetic expressions and the answers calculated by the code. For this program, it is fine to use "hard-coded" values (the numbers used in the calculations are provided in the code) rather than user input. Be sure to format the code correctly and include relevant comments in the source code (including the comment at the top of the file with your name and identification of the program).

/* Two arithmetic expressions with integers and floating point calculations*/

#include
int main()
{
    //integer a=5 and b=10
    int a=5, b=10, c;

    //fractional numbers 2.5 and 3.6 calculate
    float x=2.5, y=3.6, z;

    /*actual initialization*/
    c=a+b;
    z=x+y;

    //print newline a=5 b=10
    printf("n a=5, b=10");

    //print newline x=2.5 y=3.6
    printf("n x=2.5, y=3.6");

    //print new line int a + b =c
    printf("n %d + %d =%d",a,b,c);

    //print new line float x + y =z
    printf("n %f + %f =%.2f",x,y,z);

    //print new line
    printf("n");
    return 0;

Solution Preview :

Prepared by a verified Expert
Business Management: Write a single program that prints the results of two
Reference No:- TGS01732653

Now Priced at $20 (50% Discount)

Recommended (91%)

Rated (4.3/5)