clanguage07@gmail.com

clanguage07@gmail.com

Saturday, June 16, 2012

TOTAL DISTANCE TRAVELLED BY VEHICLE IN%d INTERVALS OF TIME:

#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();
 }

No comments:

Post a Comment

GET MORE INFORMATION

http://ads.qadservice.com/t?id=c2168e05-8974-4816-872a-91936ff7379d&size=1024x768&drct=true