The user will input two numbers, say 19 and 5. We need to equally divide 19 equally into 5 groups and output the start index and the end index of each group (using zero-based indexes). Example:Grp 1: 0   1   2   3Grp 2: 4   5   6   7Grp 3: 8   9   10  11Grp 4: 12  13  14  15Grp 5: 16  17  18The output should be Grp 1: 0   3Grp 2: 4   7Grp 3: 8   11Grp 4: 12  15Grp 5: 16  18I have written the program. But I feel it is not good. Can you please tell me if there is any other way. #include<stdio.h>#define A 19#define B 5#define PER_ENTRY A/Bstruct divide {    int start;    int end;};void calc_even(struct divide *div, int no){    int remain = A % B ;    int extra_add = 1;    if (no > remain) {        extra_add = 0;    }    static int priv_end = 0;    if (no == 1) {        div->start = 0;        div->end = (PER_ENTRY - 1) + extra_add ;    } else {        div->start = priv_end + 1;        if (no == B) {            div->end = A - 1;        } else {            div->end = div->start + (PER_ENTRY - 1) +  extra_add ;        }    }    priv_end = div->end;}int main(){    int i = 0;    struct divide num_diff[B];    for (i = 1 ; i <= B ; i++ ){        num_diff[i-1].start = 0;        num_diff[i-1].end = 0;        calc_even(&num_diff[i-1], i);    }    for (i = 1 ; i <= B ; i++ ) {        printf(Grp%d: %d %d \n, i, num_diff[i-1].start, num_diff[i-1].end);    }}Can anyone tell me how the solution could be optimized?
Distribute an array of numbers equally
c