Computer Science, asked by sajiyashrestha1, 1 year ago

Write a program to find the distance travelled by a body.(s=ut+1\2at^2)

Answers

Answered by shiva18122005
2

Explanation:

To solve for distance use the formula for distance d = st, or distance equals speed times time. Rate and speed are similar since they both represent some distance per unit time like miles per hour or kilometers per hour. If rate r is the same as speed s, r = s = d/t.

Answered by Anonymous
1

Answer:

good morning

Explanation:

Algorithm:

Step 1: Start

Step 2: Read interval as integer

Step 3: for counter: 1 to interval increment counter by 1

       begin

           Read time, velocity, acceleration

           Distance += (velocity * time + (accelerations * pow(time, 2)) / 2);

       end

Step 4: Print Distance

Step 5: Stop

Flowchart:

Program:

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()                      e

{

  int i, n, sec;

  float d, u, a;

  clrscr();

  printf("Enter the no. of intervals\n");

  scanf("%d", &n);

  for(i = 1; i <= n; i++)

  {

     printf("interval: %d \n", i);

     printf("Enter the time in seconds \n");

     scanf("%d",&sec);

     printf("Enter the velocity \n");

     scanf("%f", &u);

     printf("Enter the acceleration \n");

     scanf("%f", &a);

     d= d + (u * sec + (a * (pow(sec, 2))) / 2);

  }

  printf("Total distance travelled is  %.2f", d);

  getch();

}

Input & Output:

Enter the number of intervals: 2

Interval: 1

Enter the time in seconds  

30

Enter the velocity  

35

Enter the acceleration

20

Interval: 2

Enter the time in seconds  

40

Enter the velocity  

45

Enter the acceleration

30

Total distance travelled is 35850.00

Similar questions