CS homework This program converts pounds to kilograms includ

CS homework

This program converts pounds to kilograms. #include int main(void) {/* Declare variables. */double pounds, kilograms;/* Enter number of pounds from the keyboard. */printf(\"Enter the number of pounds: \ \"); scanf(\"%1f\", &pounds;);/* Compute number of kilograms equal to the specified pounds. */kilograms = pounds/2.205;/* Print the number of kilograms. */printf(\"%8.3f pounds = %8.3f kilograms \ \", pounds, kilograms);/* Exit program. */return 9;

Solution

#include <stdio.h>

int main()
{
double base, height, area;
  
printf(\"Enter the triangle base: \");
scanf(\"%lf\", &base);
printf(\"Enter the triangle height: \");
scanf(\"%lf\", &height);
  
area = (base * height) / 2;
  
printf(\"Triangle area is %.2lf\ \", area);

return 0;
}

Output:

sh-4.2$ gcc -o main *.c                                                                                                                                                                                                                                

sh-4.2$ main                                                                                                                                                                                                                                           

Enter the triangle base: 5.5                                                                                                                                                                                                                           

Enter the triangle height: 6.6                                                                                                                                                                                                                         

Triangle area is 18.15

CS homework This program converts pounds to kilograms. #include int main(void) {/* Declare variables. */double pounds, kilograms;/* Enter number of pounds from

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site