# C

#### Length of the sides of triangle program in C

#include<stdio.h> #include<math.h> float distance(int x1,int x2,int y1,int y2) { float distance; distance=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))); return distance; } int main() { int x1,x2,x3,y1,y2,y3; float a1,a2,a3; printf(“Enter the x-coordinate of vertex A\n”); scanf(“%d”,&x1); printf(“Enter the y-coordinate of vertex A\n”); scanf(“%d”,&y1); printf(“Enter the x-coordinate of vertex B\n”); scanf(“%d”,&x2); printf(“Enter the y-coordinate of vertex B\n”); scanf(“%d”,&y2); printf(“Enter the x-coordinate of vertex […]

Read More

#### X & Y intercepts program in C

#include<stdio.h> int main() { int m,c,x,y; printf(“Enter the value of m\n”); scanf(“%d”,&m); printf(“Enter the value of c\n”); scanf(“%d”,&c); printf(“The line equation is y=%dx+%d\n”,m,c); y=m*0+c; x=-c/m; printf(“The x intercept is %d\n”,x); printf(“The y intercept is %d\n”,y); return 0; }

Read More

#### Midpoint Coordinate of the line in C

To find the Midpoint Coordinate of the line, you can take help of the below C Program. Midpoint Coordinate of the line in C #include<stdio.h> int main() { float x,y; int x1,x2,y1,y2; printf(“Enter x1\n”); scanf(“%d”,&x1); printf(“Enter y1\n”); scanf(“%d”,&y1); printf(“Enter x2\n”); scanf(“%d”,&x2); printf(“Enter y2\n”); scanf(“%d”,&y2); x=(x1+x2); x=x/2; y=(y1+y2); y=y/2; printf(“Mid point of the Line is (%.1f , […]

Read More

#### C PROGRAM OF CENTROID OF A TRIANGLE

This C Program will help you to find the Centroid of a triangle. C Program of Centroid of a triangle #include < stdio.h >   int main() {     int x1, x2, x3, y1, y2, y3;     float x, y;     printf(“Enter x1\n”);     scanf(“%d”, & x1);     printf(“Enter y1\n”);     scanf(“%d”, & y1);     printf(“Enter x2\n”); […]

Read More

#### Average of 3 numbers program in C

In this C programming tutorial, we will learn how to find the average of 3 numbers with the help of C programming language. What is an average of Numbers:   The Sum of all the numbers divided the number is said to be the average of the numbers. In short, It is SUM/COUNT. c PROGRAM TO FIND THE AVERAGE OF […]

Read More

#### Hello World Program in C: Code At Glance

The Hello World Program in C  Programming language is the first program that usually anyone getting started with C programming language plays with. This is very simple Just type the below small piece of code in your C Compiler and press run. #include<stdio.h> int main(void) { printf(“Hello World!”); return 0; } That’s it you are ready […]

Read More

#### Centre Coordinate in C

In this C programming tutorial, we will learn how to find Centre Coordinate in C programming language. This C Program read the x and y coordinates of the vertex and also read a Length of a side. C PROGRAM TO DETERMINE THE CENTRE COORDINATE IN C PROGRAMMING LANGUAGE #include<stdio.h> int main() { int x,y,z; printf(“Enter the x-coordinate […]

Read More

#### Triangle sides in C Programming Language

In this C programming tutorial, we will learn how to find the Sides of Triangle in  C programming language. C Program to find the sides of a triangle. #include<stdio.h> #include<math.h> float distance(int x1,int x2,int y1,int y2) { float distance; distance=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))); return distance; } int main() { int xA,xB,xC,yA,yB,yC; //variable declaration float a1,a2,a3; printf(“Please enter the x-coordinate […]

Read More