No mood to write any fancy stuff, so i'll just write something simple. This was a very free week actually, cos I dont have lab, nor programming lab, nor physics tutorial. And i could have actually gone home on wed if I wanted to. But good boy here doesnt want to pontang MNO lecture on fri, so in the end i stayed.
Thusday was too free, so i went over to kit's room to experience NTU hall life (and to study. At least that was the idea). Ben had gone home for the week so there was an extra bed. Perfect. To be honest, i was abit disappointed with kits room, the place quite old and not as convenient. Prob too used to stepping out of my room and see the bus stop right in front, and the 3 min walk to fong seng for late night/ early morning supper. Aiyah nvm. Not THAT bad lah..you know, pple just become fussy after being too pampered. Starting to love my hall now.
Because kit doesnt want to move his sorry ass and walk 15 min to makan, i had to eat his bought-by-mama wanton flavoured cup noodles, a snickers bar, and a pack of cheezels. Very guilty now. Probably exceeded my daily intake of sodium by 4 times.
Very guilty. I did 10 pull ups to make myself feel better. Not so guilty now.
Realised kit is a bloody fako who only pretends to know computers. He doesn't even know how to do a loop program. Spent the whole night staring at the qn, didnt know how to continue. Then this morning suddenly i got it while thinking on the bus. Huge sense of accomplishment. Gonna post it here.. woohoo. can calculate CAP score one.
#include
int main(void)
{
int i, number_of_modules, mc, sum_of_mc=0;double gp, mc_x_gp, sum_of_mc_x_gp=0, cap;
printf("Enter number of modules:");scanf("%i",&number_of_modules);
for (i=1; i<=number_of_modules; i++)
{
printf("Enter MC and GP for Module #%i (0 0 to quit)",i);
scanf("%i %lf",&mc, &amp;amp;amp;amp;amp;amp;amp;gp); if (mc==0 && gp==0) break;
mc_x_gp = mc*gp; sum_of_mc += mc; sum_of_mc_x_gp += mc_x_gp;
}
cap = sum_of_mc_x_gp / sum_of_mc;
printf("Number of modules: %i \n",number_of_modules);printf("My CAP is %.2f",cap);
return 0;
}
No comments:
Post a Comment