#include<stdio.h>
#include<conio.h>
main()
{
float t, u, a,distance;
/* t- time, u- Initial velocity, a- acceleration */
char key;
clrscr();
do
{
clrscr();
printf("\n Enter the Initial Velocity U (m/sec1): ");
scanf("%f",&u);
printf("\n Enter acceleration A (m/sec2): ");
scanf("%f",&a);
printf("\n Enter Time T (minutes): ");
scanf("%f",&t);
/*Logic point*/
distance=(u*t)+0.5*a*(t*t);
printf("\n Travelled distance is %f",distance);
printf("\n\n Sir, Do more enter y, e-exit \n");
fflush(stdin);
scanf("%c",&key);
if(key=='e' || key=='E')
exit();
} while(key=='y' || key=='Y');
getch();
}
output
Enter the Initial Velocity U (m/sec1): 1
Enter acceleration A (m/sec2): 2
Enter Time T (minutes): 4
Travelled distance is 20.000000
Sir, Do more enter y, e-exit
0 comments:
Post a Comment