Sorry, can't help but post my one-liner:
Code:
#include <stdio.h>
#include <stdlib.h>
int main() { char buf[20]; int n; printf("%d\n",(n = strtol(fgets(buf, sizeof(buf), stdin)?buf:"0", 0, 10))?n -= n / 10:0); return 0;}
This is a piece of code to subtract 10% of a number, not the full specs of your code. [And I would suggest that you DON'T use this code as part of your homework - it is not for homework level use [in fact, I wouldn't suggest using this sort of thing anywhere, except when the goal is to make one-liner code].
--
Mats