Tuesday, October 7, 2008

Final Question:



Since not all MCS 213 students can try DEBUG commands because of the technical problems of our computers, search now any Turbo C program with assembly codes in it and run this in your PC. Check the result of your running C program.If the program produces the expected output, copy the Turbo C codes into your post and its result. YOu may do this by pressing Print Screen on your keyboard for the result of your program then, switch to Paint Brush and Paste. Resize the window and copy this to your post.



Answer:

#include
#define perkilo 25.5


/* Programmed by Harvey Losin *//* http://www.bikoy.com/harvey *//* webmaster@bikoy.com */
main()
{int kilo;
float amount;
clrscr();

printf("This program will ask the user to input the kilos");
printf("\n How many kilos of rice you want to buy?:");
scanf("%d",&kilo);
amount=perkilo*kilo;
printf("\nThe price per kilo of rice is P%d,perkilo");
printf("\nThe kilos of rice you bought is %d",kilo);
printf("\nYou will pay P%f",amount);
getch();
}

http://www.harveys.com/

No comments: