Last active
April 13, 2022 07:15
-
-
Save faisal95bd/ccc643797681b1a2c72f9c0ba45ef5b4 to your computer and use it in GitHub Desktop.
Calculate the total distance travelled with the formula (s = ut+1/2at2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() { | |
float u, a, t, s; // variable declaration | |
// input statement which take the values | |
printf("\n Enter initial velocity: "); | |
scanf("%f", & u); | |
printf("\n Enter acceleration: "); | |
scanf("%f", & a); | |
printf("\n Enter time required: "); | |
scanf("%f", & t); | |
s = (u * t) + ((a * t * t) / 2); // the formula | |
printf("\n \n The displacement is : %f \n \n", s); // printing the result | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment