Program Structure /*** SAMPLE PROGRAM *** Header Block This program computes the distance between two points. *********************************** ***** /**** * Preprocessor directives */ #include...


Program Structure<br>/***<br>SAMPLE PROGRAM<br>***<br>Header Block<br>This program computes the distance between two points.<br>***********************************<br>*****<br>/****<br>* Preprocessor directives */<br>#include <stdio.h><br>#include <math.h><br>Preprocessor Directives<br>* Main function */<br>int main(void)<br>Declarations<br>/* Declare variables */<br>double x1=1, yl=5, x2=4, y2=7, sidel, side2, distance;<br>* Compute sides of triangle and distance */<br>sidel = x2-x1;<br>side2 = y2-y1;<br>distance = sqrt(sidel*sidel + side2*side2);<br>Main Function<br>Statements<br>* Print distance */<br>printf(

Extracted text: Program Structure /*** SAMPLE PROGRAM *** Header Block This program computes the distance between two points. *********************************** ***** /**** * Preprocessor directives */ #include #include Preprocessor Directives * Main function */ int main(void) Declarations /* Declare variables */ double x1=1, yl=5, x2=4, y2=7, sidel, side2, distance; * Compute sides of triangle and distance */ sidel = x2-x1; side2 = y2-y1; distance = sqrt(sidel*sidel + side2*side2); Main Function Statements * Print distance */ printf("Distance = %5.2f\n",distance); * Exit program */ Return Statement return 0; ***** /******************** Program Body

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here