C Programming Tutorial – 12 – change the property of a variable:

Note:

  • //Use (float) or (int) or … before any variable to change that variable to float or int or …:

Code:
—————————

#include <stdio.h>
#include <stdlib.h>

int main()
{

int PriceOfPopcorn=100,sales=20,WorkDay=7;
float profitPerday;
profitPerday = ((float)PriceOfPopcorn*(float)sales)/(float)WorkDay;
printf(“profit per day is = $%.2f\n”,profitPerday);

return 0;

}