-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11th_program.c
More file actions
33 lines (29 loc) · 960 Bytes
/
11th_program.c
File metadata and controls
33 lines (29 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Write a program that counts number of students whose weight & height is less than 50kg & 170cm resp.
#include<stdio.h>
int main()
{
int no_of_students;
printf("Enter the total numbers of students:");
scanf("%d",&no_of_students);
float weight[no_of_students], height[no_of_students];
int i=1,weight_less_50kg=0,height_less_170cm=0;
while(i<=no_of_students)
{
printf("Enter the weight of student %d : ",i);
scanf("%f",&weight[i]);
printf("Enter the height of student %d : ",i);
scanf("%f",&height[i]);
if(weight[i]<50.0)
{
weight_less_50kg++;
}
if(height[i]<170.0)
{
height_less_170cm++;
}
i++;
}
printf("Total no of students whose weight is less than 50kg : %d \n",weight_less_50kg);
printf("Total no of students whose height is less than 170cm: %d \n",height_less_170cm);
return 0;
}