Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Calculate total distance traveled by a vehicle in t seconds is given by DISTANCE = UT + (A * T * T)/2.

Posted By: Debra Nelson     Category: C Programming     Views: 5675

Calculate total distance traveled by a vehicle in t seconds is given by

DISTANCE = UT + (A * T * T)/2.

Where u is the initial velocity(meters per second), a is the accele-ration.Write a program to evaluate the distance travelled at regular intervals of time, given the values of u and a.The program should
provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of u and a.

Code for Calculate total distance traveled by a vehicle in t seconds is given by DISTANCE = UT + (A * T * T)/2. in C Programming

#include<conio.h>
#include<stdio.h>
void main()
{
    float u,a,dist;
    int t;
    clrscr();

    printf(" Enter the value of a : ");
    scanf("%f",&a);

    printf(" Enter the year of u :- ");
    scanf("%f",&u);

    printf(" Enter the value of t :- ");
    scanf("%d",&t);


    dist = (u * t) + (a * t * t)/2;
    printf("\n The distance equal to :- %f",dist);

    getch();
}
/*
output

Enter the value of a : 4
Enter the year of u :- 5
Enter the value of t :- 6

The distance equal to :- 102.000000

*/
  
Share: 



Debra Nelson
Debra Nelson author of Calculate total distance traveled by a vehicle in t seconds is given by DISTANCE = UT + (A * T * T)/2. is from Baltimore, United States.
 
View All Articles

 

Other Interesting Articles in C Programming:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!