#include<stdio.h>
//point data type
struct point
{
int x;
int y;
} ;
//to print the dashed line
void printDashLine()
{
printf("\n");
for(int i=0;i<70;i++)
printf("-");
printf("\n");
};
int main()
{
struct point p1,p2;
double slope;
double intercept;
double test;
printDashLine();
printf("\n Linear euation creator \n\n Given (x1,y1) and (x2,y2),
this program computes equation of the line:\n\n y=mx+b \n");
printDashLine();
printf("Please enter x1 y1: ");
scanf("%d %d",&p1.x,&p1.y);
printf(" %d %d \n\n",p1.x,p1.y);
printf("Please enter x2 y2: ");
scanf("%d %d",&p2.x,&p2.y);
printf(" %d %d \n\n",p1.x,p1.y);
printDashLine();
slope=(p2.y-p1.y)/(p2.x-p1.x*1.0);
printf("Slope: %.1f\n\n" ,slope);
intercept=p2.y-slope*p2.x;
printf("y-Intercept: %.1f\n\n",intercept);
printf("Equation of the line: y= %.1fx +
%.1f\n\n",slope,intercept);
printDashLine();
printf("Please enter a value for x: ");
scanf("%.1f",&test);
printf(" %.1f\n\n",test);
printf("This value is mapped to y:
%.1f\n",slope*test+intercept);
printDashLine();
printf("\n\n\n");
printDashLine();
printf("Address \t\t Contents \t\tVariable");
printDashLine();
printf("%p \t\t %5d \t\t x1\n\n",&p1.x,p1.x);
printf("%p \t\t %5d \t\t
x2\n\n",&p2.x,p2.x);
printf("%p \t\t %5d \t\t
y1\n\n",&p1.y,p1.y);
printf("%p \t\t %5d \t\t
y2\n\n",&p2.y,p2.y);
}
/*
Output
---------------------------------------------------------------------- Linear euation creator Given (x1,y1) and (x2,y2), this program computes equation of the line: y=mx+b ---------------------------------------------------------------------- Please enter x1 y1: -1 -1 Please enter x2 y2: -1 -1 ---------------------------------------------------------------------- Slope: 3.0 y-Intercept: 2.0 Equation of the line: y= 3.0x + 2.0 ---------------------------------------------------------------------- Please enter a value for x: 0.0 This value is mapped to y: 2.0 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Address Contents Variable ---------------------------------------------------------------------- 0x7fff709be610 -1 x1 0x7fff709be620 1 x2 0x7fff709be614 -1 y1 0x7fff709be624 5 y2
Input
-1 -1 1 5
*/
write the program in Latex form and please type it out. ECE 270 Advanced Computer Methods in ECE Assignment #1 May 1...
ECE 270 Computer Methods in ECE OnLine Quiz #5 June 4, 2019/Instructor: Paul Watta 1. Math Analysis. Given the following sequence operation, please do a mathematical analysis as outlined on page 1 of the Sequence and Array Operations notes (parts a - d). Insert Subsequence. The sequence y has all of the elements of x along with an inserted subsequence: Po Po... Pm-1. Let k be the index where the insert occurs. 2. Programming. Write a program to implement the...
Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...