Assalamualaikum,
This is the correction i've made to hafiz coding.
//Writer: Hafiz Yusof
#include <stdio.h>
int main()
{
int voltage=20;
int current=6;
int resistance,remainder;
resistance=voltage/current;
remainder=voltage%current;
printf("the resistance value is %d\n",resistance);
printf("the remainder value is %d\n",remainder);
return 0;
}
comment:
overall is ok..
but for the resistance value, it will be perfect if the answer is in floating number.
for example 20 divide by 6 suppose the answer is 3.3333.
in your coding you put it as int which make the answer is 3.
good luck!
C PRO EXERCISE 2.. 17/07/2012
Written by Unknown on Thursday, 19 July 2012 at 09:20
Subscribe to:
Post Comments (RSS)
0 Responses to "C PRO EXERCISE 2.. 17/07/2012"
Post a Comment