# C program to read the height of a person and the print person is taller, dwarf, or average height person

Here, we are going to learn how to read the height of a person and the print person is taller, dwarf, or average height person using C program?
Submitted by Nidhi, on August 27, 2021

Problem Solution:

Here, we will create a double variable height and read its value from the user and print the person is taller, dwarf, or average height person.

Program:

The source code to read the height of the person and the print person is taller, dwarf or average height person is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.

```// C program to read the height of the person,
// and print person is taller, dwarf, or
// average height person

#include <stdio.h>

int main()
{
double height = 0;

printf("Enter Height (in centimetres): ");
scanf("%lf", &height);

if ((height >= 150.0) && (height <= 170.0)) {
printf("Person is average height person");
}
else if ((height > 170.0) && (height <= 195.0)) {
printf("Person is taller");
}
else if (height < 150.0) {
printf("Person is dwarf");
}
else
printf("Abnormal height \n");

return 0;
}
```

Output:

```RUN 1:
Enter Height (in centimetres): 172
Person is taller

RUN 2:
Enter Height (in centimetres): 147
Person is dwarf
```

Explanation:

Here, we created a variable height of double type, and read the value of the height variable in centimeters. After that, we checked the value of height and the print person is taller, dwarf, or average height person on the screen.

What's New

Top Interview Coding Problems/Challenges!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates