#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int interval,counter,time;
float acc1,dis=0,vel;
clrscr();
printf("===PROGRAM FOR CALC TOTAL DISTANCE TRAVELLED BY A VEHICLE===");
printf("\n\t Enter the number of time intervals:");
scanf("%d",&interval);
for(counter=1;counter<=interval;counter++)
{
printf("\n\t Enter time at T%d(sec):",counter);
scanf("%d",&time);
printf("\t Enter the velocity at %d sec(m/sec):",time);
scanf("%f",&vel);
printf("\t Enter the accelaration at%d sec(m/sec^2):",time);
scanf("%f",&acc1);
dis+=vel*time+(acc1*pow(time,2)/2);
}
printf("\nTOTAL DISTANCE TRAVELLED BY VEHICLE IN%d INTERVALS OF TIME:%f",interval,dis);
getch();
}
#include<conio.h>
#include<math.h>
void main()
{
int interval,counter,time;
float acc1,dis=0,vel;
clrscr();
printf("===PROGRAM FOR CALC TOTAL DISTANCE TRAVELLED BY A VEHICLE===");
printf("\n\t Enter the number of time intervals:");
scanf("%d",&interval);
for(counter=1;counter<=interval;counter++)
{
printf("\n\t Enter time at T%d(sec):",counter);
scanf("%d",&time);
printf("\t Enter the velocity at %d sec(m/sec):",time);
scanf("%f",&vel);
printf("\t Enter the accelaration at%d sec(m/sec^2):",time);
scanf("%f",&acc1);
dis+=vel*time+(acc1*pow(time,2)/2);
}
printf("\nTOTAL DISTANCE TRAVELLED BY VEHICLE IN%d INTERVALS OF TIME:%f",interval,dis);
getch();
}
No comments:
Post a Comment