C++ examples for Data Type:float
Calculate interest using int and float type
#include <stdio.h> int main()//from w ww . j a va 2 s . c om { int days=45; float principle = 3500.00; float interest_rate=0.155; float daily_interest; daily_interest=interest_rate/365; // Because days is int, it too is converted to float. daily_interest = principle * daily_interest * days; principle+=daily_interest; printf("The balance you owe is %.2f\n", principle); return 0; }