|
Friday, March 17, 2006 hey..in my midst of mugging for the coming exams..or rather trying to catch up what I've been lagging behind lar..I just want to share with u guys what a horrible subject computing is.haaa.. cheers.. /* Program to express fraction as int+fraction */ #include int main(void) { int numerator, denominator, integer, n, d, value; printf("Please enter the numerator of the fraction:"); scanf("%d", &numerator); printf("Please enter the denominator of the fraction:"); scanf("%d", &denominator); n=numerator; d=denominator; integer = (int) n/d; do { value=n; n=d; d=value%n; }while (d!=0); d=denominator/n; n=(numerator-integer*denominator)/n; printf("The fraction is equal to %d+%d/%d.\n", integer, n , d); return 0; } Anonymous rocking off at 3:00 PM *** |
Hwa Chong Junior College 03S73
*Mrs Goh! *Chewy *Qingzhao *Jaymie *Jiaho *05s73 *06s73 |