Hello users!
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!
My code is
Thank you!Code:int main() { int a,b; float avg; float square; printf("Enter the value of a:"); scanf("%d", &a); printf("Enter the value of b:"); scanf("%d", &b); if (a==b) square = a * b; printf("%f", square); else avg = (a+b)/2; printf("%f", avg); return 0; }