BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/index.php)
-   Object Oriented Programming (http://bzupages.com/forumdisplay.php?f=300)
-   -   Program to enter velocity, acceleration and time and print final velocity (http://bzupages.com/showthread.php?t=14552)

bonfire 01-03-2011 02:21 PM

Program to enter velocity, acceleration and time and print final velocity
 
1 Attachment(s)
Program to enter velocity, acceleration and time and print final velocity using the formula : v = u + a * t


#include
#include

void main()
{
clrscr();
int v,u,a,t;
cout << "Enter the velocity, acceleration, time as integers : " << endl;
cin>>u>>a>>t;
v=u+a*t;
cout << "The final velocity is " << v << "." << endl;
getch();
}
This program takes in the velocity, acceleration and the time as a screen input from the user.
The final velocity is calculated using the formula v = u + a * t, and then outputted using the 'cout' command.

Sample Input
20 10 5
Sample Output
The final velocity is 70.


All times are GMT +5. The time now is 09:00 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.