How to run another function after a function in C program

Solution 1:

You need to call the second function revenueProgram() inside of your main() function, before return 0;. Also, declare the second function before main().

Something like:

#include <stdio.h> //adding program

int revenueProgram(); //function prototype declaration

int main()
{
    int iOperand1 = 0;
    int iOperand2 = 0;

    printf("\n\tAdder Program, by Keith Davenport\n");
    printf("\nEnter first operand: ");
    scanf_s("%d", &iOperand1);

    printf("Enter second operand:");
    scanf_s("%d", &iOperand2);

    printf("The result is %d\n", iOperand1 + iOperand2);

    revenueProgram();

    return 0;
}

int revenueProgram()  //Revenue program
{
    float fRevenue, fCost;      

    printf("\nEnter total revenue:");
    scanf_s("%f", &fRevenue);

    printf("\nEnter total cost:");
    scanf_s("%f", &fCost);

    printf("\nYour profit os $%.2f\n", fRevenue - fCost);
    return 0;
}