Hello **Programmers/Coders,** Today we are going to share ** solutions of Programming problems of HackerRank of Programming Language C **. At Each Problem with Successful submission with

**all Test Cases Passed,**you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight you profile to the recruiters.

In this post, you will find the solution for **Input and Output in C-HackerRank Problem**. We are providing the **correct and tested solutions** of coding problems present on **HackerRank**. If you are not able to solve any problem, then you can take help from our Blog/website.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

**C **is one of the most widely used **Programming Languages**. it is basically used to build **Operating System**. **C **was developed by **Dennis Ritchie in 1972**. Below are some examples of **C Programming** which might you understanding the **basics of C Programming.**

**Read Also Articles**

#### Objectives

You are given * n, *triangles, specifically, their sides

**a**

**i,****b**

*and*

**i****c**

*. Print them in the same style but sorted by their areas from the smallest one to the largest one. It is guaranteed that all the areas are different. The best way to calculate a volume of the triangle with sides a, b and c is Heron’s formula:*

**i****s = √(P * (P – a) * (P – b) * (P – c))**where

**P = (a+b+c)/2.**

**Input Format **

First line of each test file contains a single integer * n*.

*lines follow with*

**n****a**

**i,****b**

*and*

**i****c**

*on each separated by single spaces.*

**i****Constraints**

**1****1i, b***i*, c*i***a***i*+ b*i*> c*i*, a*i*+ c*i*> bi and b*i*+c*i*> a*i*

**Output Format**

Print exactly** n **lines. On each line print 3 integers separated by single spaces, which are **a****i, ****b*** i* and

**c**

*of the corresponding triangle.*

**i****Sample Input :-**

3 7 24 25 5 12 13 3 4 5

**Sample Output :-**

3 4 5 5 12 13 7 24 25

**Explanation**

The square of the first triangle is **84**. The square of the second triangle is **30**.The square of the third triangle is **6**. So the sorted order is the reverse one.

Small Triangles, Large Triangles in c – Hacker Rank Solution

#include#include #include struct triangle { int a; int b; int c; }; typedef struct triangle triangle; void sort_by_area(triangle* tr, int n) { int *p=malloc(n*sizeof(float)); //create array of size n to store "volumes" for(int i=0;i p[j+1]) { int temp=p[j]; p[j]=p[j+1]; p[j+1]=temp; //swapping array of areas in ascending //and simuntaneously the structure contents temp=tr[j].a; tr[j].a=tr[j+1].a; tr[j+1].a=temp; temp=tr[j].b; tr[j].b=tr[j+1].b; tr[j+1].b=temp; temp=tr[j].c; tr[j].c=tr[j+1].c; tr[j+1].c=temp; } } } } int main() { int n; scanf("%d", &n); triangle *tr = malloc(n * sizeof(triangle)); for (int i = 0; i