#include<stdio.h>
#include <stdlib.h>
int triArea(x, y) {
int baseTimesHeight = x * y;
int area = baseTimesHeight / 2;
return area;
}
int main() {
int x = 0;
int y = 0;
printf("Enter an integer value for the length: \n");
scanf("%d", &x);
printf("Enter an integer value for the height: \n");
int area1 = triArea(x ,y);
printf("The area of the triangle is: %d\n", area1);
printf("Hello world!\n");
return 0;
}
this is the code that i wrote for a simple calculation (I am VERY new to programming in c and low level languages) however no matter the program if it has a scanf it will not output any other code. Anyone have idea as to why this happens? I'd like both a solution and explanation if possible!:)