write a program in c to print s=ut+1/2at^2
Answers
Answered by
16
Answer:
Snippet
double s;
s=(u*t)+(1/2)*a*(t*t);
System.out.println (s);
Answered by
12
The c program for the above question is listed below:
Explanation:
#include <stdio.h> // header file inclusion.
int main() // main function declaration
{
float u,a,t,s; // variable declaration.
printf("Enter the value of u then a and then t"); // instruction for the user.
scanf("%f %f %f",&u,&a,&t); // input statement which take the value.
s=(u*t)+((a*t*t)/2); // conclude the s.
printf("%f",s); // print the s.
return 0; // return statement.
}
Output:
- If the user enter U=2,a=3 and t=4 then the output is 32.
- If the user enter U=2.5,a=3.5 and t=4.5 then the output is 46.687500.
Code explanation:
- This program first displays the message refers to the instruction for the user.
- Then the user enters the message.
- Then it processed the value of s by the help of s.
Learn More:
- C-program : https://brainly.in/question/637147
- C-program : https://brainly.in/question/3999878
Similar questions