A few days into C-programmering experience: if and else
As stated in the title, I am very new to C and programming languages in general.
I am currently reading various guides and such, but I've come across a syntax problem when using if and else.
I did a little code to try it. The idea is having two integers, a and b. If a and b are equal, I want the program to calculate the product of the two. Else I want it to find the average of those numbers.
I'm pretty sure my problem is lack of / misplaced brackets and tokens, but I cannot figure out the syntax! :confused:
My code is
printf("Enter the value of a:");
printf("Enter the value of b:");
square = a * b;
avg = (a+b)/2;