Wednesday 21 December 2011

PROGRAM TO CALCULATE THE DISTANCE TRAVELLED


  • To input speed per hour and elapsed time and to calculate and display the distance travelled.
#include<stdio.h>
Void main()
{
Float distance,time,speed;
Clrscr();
Printf(“speed in Km/Hr?”);
Scanf(“%f”,&speed);
Printf(“time of journey?”);
Scanf(“%f”,&time);
distance=speed*time;
Printf(“%.2f Kms travelld within %.2fHrs at a speed of %.2fKm/Hr.”,distance,time,speed);
getch();
}



No comments:

Post a Comment