Digging codes
Friday, 1 February 2013
Modulus operator using * and /
// Program to implement modulus operator using * and /
#include <stdio.h>
int my_mod( int a, int b){
return ( a - (b*(a/b)));
}
int main(){
int a = 11;
int b = 2;
printf("Remainder = %d\n", my_mod(a,b));
getch();
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment