'Finding bar graph showing the percentages of two different entities in c programming using graphics.h header file from user input

I want to implement this code by finding user input data of male and female percentage of a school. But I found some difficulties finding the calculation of malePercentage variable and femalePercentage variable. I want to show this bar graph from 0 to 100 on the Y-axis showing the appropriate percentage of each of them. How to implement it?

#include<graphics.h>
#include<conio.h>
#include<stdio.h>

void MaleFemaleGraph()
{
    int gd = DETECT, gm;

    int malePercantage, femalePercantage;
    printf("Enter male percentage : ");
    scanf("%d", &malePercantage); // Taking input of percentage of male from user
    printf("Enter female percentage : ");
    scanf("%d", &femalePercantage); // // Taking input of percentage of male from user

    initgraph(&gd, &gm, " ");

    line(50,50,50,420); // X - Axis
    line(50,420,600,420); // Y - Axis

    setfillstyle(SOLID_FILL,LIGHTGREEN); // Male bar in Lightgreen color
    bar(155, malePercantage, 255, 420);  // Male Bar

    setfillstyle(SOLID_FILL,CYAN); // Female Bar in Cyan color
    bar(295, femalePercantage, 395, 420);  // Female Bar

    outtextxy(185,440,"Male"); // Labeling Male bar
    outtextxy(320,440,"Female"); // Labeling Female bar

    getch();
    closegraph();

}

int main()
{


    MaleFemaleGraph();

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source