Programming for Problem Solving

GTU Practical 23

23. Read five persons’ height and weight and count the number of people having a height greater than 170 and weight less than 50,
#include<stdio.h>  ( this applies in the given code )

#include

int main()
{
int person,height,weight,count=0;
for(person=0;person170)
{
if(weight 170 and Weight < 50 : %d",count); return 0; }

OUTPUT

Enter height (in cm) and weight (in kg) for person 1: 175 48
Enter height (in cm) and weight (in kg) for person 2: 160 55
Enter height (in cm) and weight (in kg) for person 3: 180 45
Enter height (in cm) and weight (in kg) for person 4: 165 52
Enter height (in cm) and weight (in kg) for person 5: 172 49

Number of people with height > 170 cm and weight < 50 kg: 2

GTU STUDY