Hi, how could I implement functions into this code to make the readability and usability better? Thank you
Code:
#include <stdio.h>


int main()
{
    int Orange = 0;
    int Apple = 0;
    int Pear = 0;
    int Budget = 0;
    char ItemChosen = 0;
    int RemainingBudget = 0;




    printf("Please enter the price of Oranges :");
    scanf_s(" %d", &Orange);
    printf("Please enter the price of Apples :");
    scanf_s(" %d", &Apple);
    printf("Please enter the price of Pears :");
    scanf_s(" %d", &Pear);




    printf("**************************************\n");
    printf("Hello and welcome to my fruit shop\n");
    printf("Please enter your budget : ");
    scanf_s(" %d", &Budget);




    printf("**************************************\n");
    printf("Shop Menu : \n");
    printf("Item:       Price:\n");
    printf("O:          %d\n", Orange); 
    printf("A:          %d\n", Apple);
    printf("P:          %d\n", Pear);




    printf("**************************************\n");
    printf("Please type what item of fruit you would like to purchase : ");
    scanf_s(" %c", &ItemChosen);


    if (ItemChosen == 'A') {
        if (Apple <= Budget) {
            printf("Your purchase has been successful!\n");
            printf("Purchase details\n");
            printf("---------------------------------\n");
            printf("Item selected : %c\n", ItemChosen);
            printf("item price : %d\n", Apple);
            RemainingBudget = Budget - Apple;
            printf("Remaining budget : %d\n", RemainingBudget);
            printf("Thank you for Shopping with us!");
        }
        else {
            printf("Error your budget has insufficant funds or Missing item\n");
            printf("Thanks for shopping with us!\n");
        }
    }
    else if (ItemChosen == 'P') {
        if (Pear <= Budget)
        {
            printf("Your purchase has been successful!\n");
            printf("Purchase details\n");
            printf("---------------------------------\n");
            printf("Item selected : %c\n", ItemChosen);
            printf("item price : %d\n", Pear);
            RemainingBudget = Budget - Pear;
            printf("Remaining budget : %d\n", RemainingBudget);
            printf("Thank you for Shopping with us!");
        }
        else {
            printf("Error your budget has insufficant funds or Missing item\n");
            printf("Thanks for shopping with us!\n");
        }
    }
    else if (ItemChosen == 'O') {
        if (Orange <= Budget) {
            printf("Your purchase has been successful!\n");
            printf("Purchase details\n");
            printf("---------------------------------\n");
            printf("Item selected : %c\n", ItemChosen);
            printf("item price : %d\n", Orange);
            RemainingBudget = Budget - Orange;
            printf("Remaining budget : %d\n", RemainingBudget);
            printf("Thank you for Shopping with us!");


        }
        else {
            printf("Error your budget has insufficant funds or Missing item\n");
            printf("Thanks for shopping with us!\n");
        }
    }
    else
    {
        printf("Incorrect item [%c] selected.\n", ItemChosen);
        printf("Thanks for shopping with us!\n");
    }


    return 0;
}