fork download
  1. #include <assert.h>
  2.  
  3. int mod_256(int x)
  4. {
  5. if(x >= 0) { return (int)(unsigned char)x; }
  6. else { return -(int)(unsigned char)-x; }
  7. }
  8.  
  9. int main()
  10. {
  11. assert(mod_256(257) == 257 % 256);
  12. assert(mod_256(-257) == -257 % 256);
  13. return 0;
  14. }
Success #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
Standard output is empty