Wrong output for second cout statement

#include <iostream>
#include <cmath>
using namespace std;

int main()

{

double time;
double g = 8.83;
double velocity;

cout<<"Enter the time ";
cin>>time;
velocity = g*time;
cout<<"After "<<time<<" seconds, the velocity on venus is "<<velocity<<" meters per second."<<endl;
double distance = (1/2)*velocity*time;
cout<<"After "<<time<<" seconds, the falling distance on venus is "<<distance<<" meters."<<endl;



return (0);
}

//I am getting a falling distance on venus to be zero, but this is not correct.
//What do you think i did wrong?



(1/2) is 0

(1.0/2.0) is 0.5
Last edited on
Topic archived. No new replies allowed.