logo
  • Home
  • About
  • Training
  • Programming
  • CS
  • IT
  • IS
  • ECE
  • EEE
  • EE
  • Civil
  • Mechanical
  • Chemical
  • Metallurgy
  • Instrumentation
  • Aeronautical
  • Aerospace
  • Biotechnology
  • Agriculture
  • MCA
  • BCA
  • Internship
  • Contact

Questions & Answers

C Interview Questions
C++ Questions
Linux MCQs
C# Quiz
Java MCQs
JavaScript MCQs
SAN Questions
PHP Questions
Python Quiz

Computer Science Questions

Operating System Quiz
Computer Architecture MCQs
Software Architecture MCQs
Software Engineering MCQs
Artificial Intelligence MCQs
LISP Programming MCQs
Database Management MCQs
Computer Network MCQs
Microprocessor MCQs

C Programming Examples

Simple C Programs
C - Arrays
C - Matrix
C - Strings
C - Bitwise Operations
C - Linked Lists
C - Stacks & Queues
C - Searching & Sorting
C - Trees
C - Strings
C - File Handling
C - Mathematical Functions
C - Puzzles & Games
C Programs - Recursion
C Programs - No Recursion

Java Algorithms

Java - Numerical Problems
Java - Combinatorial Problems
Java - Graph Problems
Java - Hard Graph Problems
Java - Computation Geometry
Java - Sets & Strings
Java - Data-Structures
Java - Collection API Problems

C++ Algorithms

C++ - Numerical Problems
C++ - Combinatorial Problems
C++ - Graph Problems
C++ - Hard Graph Problems
C++ - Computation Geometry
C++ - Sets & Strings
C++ - Data-Structures
C++ - STL Library

C Algorithms

C - Numerical Problems
C - Combinatorial Problems
C - Graph Problems
C - Hard Graph Problems
C - Computation Geometry
C - Sets & Strings
C - Data-Structures

« Prev Page
Next Page »

C Program to Accept the Height of a Person & Categorize as Taller, Dwarf & Average

Posted on November 7, 2012 by staff10

This C program accepts the height of a person & categorize as taller, dwarf & average.

Problem Description

This program accepts the height of a person as input and categorizes as taller, dwarf & average.

Problem Solution

1. Take the height of a person as input.
2. Using if,else statements, categorize it as taller, dwarf & average and print the output accordingly.
3. Exit.

Program/Source Code

Here is source code of the C program to accept the height of a person & categorize as taller, dwarf & average. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

  1. /*
  2.  * C program to accept the height of a person in centimeter and
  3.  * categorize the person based on height as taller, dwarf and
  4.  * average height person
  5.  */
  6.  
  7. #include <stdio.h>
  8. void main()
  9. {
  10.     float height;
  11.  
  12.     printf("Enter  the Height (in centimetres) \n");
  13.     scanf("%f", &height);
  14.     if (height < 150.0)
  15.         printf("Dwarf \n");
  16.     else if ((height >= 150.0) && (height <= 165.0))
  17.         printf(" Average Height \n");
  18.     else if ((height > 165.0) && (height <= 195.0))
  19.         printf("Taller \n");
  20.     else
  21.         printf("Abnormal height \n");
  22. }
Program Explanation

1. Take the height of a person as input and store it in the variable height.
2. If the variable height is lesser than 150 cm, then print the output as “Dwarf”.
3. If the variable height is lesser than or equal to 165 cm and greater than or equal to 150 cm, then print the output as “Average Height”.
4. If the variable height is lesser than or equal to 195 cm and greater than 165 cm, then print the output as “Taller”.
5. Exit.

Runtime Test Cases
Enter  the Height (in centimetres)
165
Average Height
 
Enter  the Height (in centimetres)
140
Dwarf
 
Enter  the Height (in centimetres)
190
Taller

Sanfoundry Global Education & Learning Series – 1000 C Programs.

Here’s the list of Best Reference Books in C Programming, Data-Structures and Algorithms

If you wish to look at other example programs on Simple C Programs, go to Simple C Programs. If you wish to look at programming examples on all topics of C, go to C Programming Examples.
« Prev Page - C Program to Read a Grade & Display the Equivalent Description
» Next Page - C Program to Simulate a Simple Calculator
« C Program to Read a Grade & Display the Equivalent Description
C Program to Simulate a Simple Calculator »

Deep Dive @ Sanfoundry:

  1. C# Programming Examples on Sorting
  2. C Questions and Answers
  3. C Programming Examples on Strings
  4. C Programming Examples on Searching and Sorting
  5. C# Programming Examples on Networking
  6. Python Programming Examples
  7. C# Programming Examples on Arrays
  8. C Programming Examples on Arrays
  9. Simple C Programs
  10. C# Basic Programming Examples
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him below:
LinkedIn | Facebook | Twitter | Google+

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.

Best Trainings

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

Best Reference Books

Computer Science Books
Algorithm & Programming Books
Electronics Engineering Books
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books

Questions and Answers

1000 C Questions & Answers
1000 C++ Questions & Answers
1000 C# Questions & Answers
1000 Java Questions & Answers
1000 Linux Questions & Answers
1000 Python Questions
1000 PHP Questions & Answers
1000 Hadoop Questions
Cloud Computing Questions
Computer Science Questions
All Stream Questions & Answers

India Internships

Computer Science Internships
Instrumentation Internships
Electronics Internships
Electrical Internships
Mechanical Internships
Industrial Internships
Systems Internships
Chemical Internships
Civil Internships
IT Internships
All Stream Internships

About Sanfoundry

About Us
Copyright
TOS & Privacy
Jobs
Bangalore Training
Online Training
SAN Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
© 2011 Sanfoundry