Code:
#include <iostream> using namespace std; int main () { int numberOfStems=100; float lowMark=1/4; cout << "Low Mark= " << lowMark <<endl; //This outputs 0 cout << "Pass Mark=" << 40*numberOfStems/100 << endl; //This outputs 40 return 0; }
#include <iostream> using namespace std; int main () { int numberOfStems=100; float lowMark=1/4; cout << "Low Mark= " << lowMark <<endl; //This outputs 0 cout << "Pass Mark=" << 40*numberOfStems/100 << endl; //This outputs 40 return 0; }
float lowMark=1.0/4.0;
float lowMark=1.0f/4.0f;
Comment