
| Turbo C - (Basic) Simple Calculator |
|
#include<stdio.h> #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(); } |