The mod operator is simply the remainder after division. For example, 4%2 is 0 because the remainder after 4/2 is 0. The mod operator works only on integers, not floats or doubles. There is no code to give you because that's all it is -- a simple 5th grade math operation.

Then just use normal division (either float or double). After doing the divion you can call modf() to split the variable into integer and fractional parts. Certainly a lot easier to just use % operator.

int a = 40;
int b = 3;
double intpart = 0;
double result = (double)a/b;
double fract = modf(result,&intpart);
int result = (int)fract*10; // convert 0.3333... to just 3

# include <stdio.h>
int main(){
int a=10,b=3,reminder;
// suppose you want a%b.
reminder = a -(a/b)*b;
printf("\n\n Reminder of %d/%d is %d",a,b,reminder);
return 0;
}

So, I'm relatively new to programming and I'm working on a program that allows for input of grades, course hours, and then calculates GPA based on that. But, I'm going ...

I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...