-3
#include <iostream>
using namespace std;
int main()
{
double basic = 1000;
double DA = (10/100) * basic;
double HRA = (30/100) * basic;
cout<<"DA = "<<DA<<endl; // why the answer is 0 ?
cout<<"HRA = "<<HRA<<endl; // why the answer is 0 ?
return 0;
}

Please Help me....I do not understand why the DA and HRA is giving 0 answer?

1 Answers1

1

10/100 = 0 as 10 and 100 are both int and their result will aslo be int.

Try 10/100.0

30/100.0

vishal
  • 249
  • 3
  • 7