I need help as to why this is not working, I think it is because I have turned everything to a float from an integer the scanf function has changed so how can I get this to work.

Code
#include <stdlib.h>
#include <stdio.h>

int main()
{
    float avg;
    int num1;
    int num2;

    printf("Enter first number: \n");
    scanf("%d", &num1);

    printf("Enter second number: \n");
    scanf("%d", &num2);

    avg = ((float)num1 + (float)num2) / 2;

    printf("The average is: %.2f", avg);

    return 0;
}

Thanks for the help in return.