Hello,

I solved some exercises on the textbook calledA First Book of ANSI Cby myself and really happy about that. I have a major problem with one exercise. It says i have to use the (int) cast, devise a method to round the values in the variables a and b to the nearest hundredth (penny value) before they are added.

I have no idea what the question means!!! Any advice? I read a different book i brought from Korea to solve it in my own way but I dont know its right or not.

I tried to find solutions for the textbook but cant find it.

Question

My code:Code:double a, b, c; a = 1.674; b = 1.322; printf("\n%4.2f",a); printf("\n%4.2f",b); printf("\n----"); c = a + b; printf("\n%4.2f\n",c);

Code:#include<stdio.h> #include <math.h> int main() { double a, b, c; a = 1.674; b = 1.322; double round (double x); a = round(a*100)/100; b = round(b*100)/100; printf("\n%4.2f",a); printf("\n%4.2f",b); printf("\n----"); c = a + b; printf("\n%4.2f\n",c); return 0; }