# what is wrong with my code? I use C language

/* This program implements the pseudocode.

Written by:

Date:

*/

#include <stdio.h>

int main (void)

{

// Local Declarations

float a;

float b;

float x;

float y;

float total;

// Statements

printf("Enter a number: ");

scanf ("%f", &x);

printf("Enter another number: ");

scanf ("%f", &y);

x = a * b;

y = a + b;

total = 3y + x * (y – a) * (x + b);

printf ("The total is %f\n", total);

return 0;

} // main

answered Dec 9, 2020 by (66,990 points)

## Problem #1

3y means nothing to the compiler. If you want 3 times y, you have to say

`3 * y`

## Problem #2

A dash is not a minus sign.

Please note, that in the formula "total = 3y + x * (y – a) * (x + b);" you have a dash between y and a, not a minus sign

```// – is a dash
// - is a minus sign
// correct formula:
total = 3 * y + x * (y - a) * (x + b);```

## Problem #3

The variables a and b are not read. You read x and y instead, but you instantly overwrite their value with calculation used by the uninitialized a and b.

Did you mean:

```scanf("%f", &a);
scanf("%f", &b);```