Hey guys i need a bit of help in getting my answer correct. Basically , im trying to get my answer to 2 decimal places when i divide one number by another...
int main(){
int Totalgpa = 46;
int e = 13;
int SemesterGpa = Totalgpa / e ;
cout << SemesterGpa << endl;
}
The answer i would get will just be 3 as it will round off the answer.
So i tried another method i read from here
int main () {
int Totalgpa = 46;
int e = 13;
double SemesterGpa = double Totalgpa / e ;
cout << SemesterGpa << endl;
}
The answer i would get will just be 3.5384615348.......
How can i modify my coding in order for the answer to just be 3.54 ( to 2 decimal places only).